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 ?
1 Answer
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'}