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 Answer 1

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$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .