0
$\begingroup$

For example, in the template in the text editor has an example script that utilizes a modal function with mousemove to change the location of the object along and axis, how can I use the same function, but instead it's the scroller that controls the function ?

$\endgroup$
1
$\begingroup$

The event.type that you get within modal() will be WHEELUPMOUSE or WHEELDOWNMOUSE when the scrollwheel is used.

def modal(self, context, event):
    if event.type == 'WHEELUPMOUSE':
        context.object.location.x += 0.5
    elif event.type == 'WHEELDOWNMOUSE':
        context.object.location.x -= 0.5
    elif event.type == 'ESC':
        return {'CANCELLED'}

    return {'RUNNING_MODAL'}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.