I'm trying to write a modal operator for the timeline, but I'm confused about how to get the current frame cursor in the timeline to follow a 'mousemove' event (and consequently, how to set the new current frame when the operator finishes).


Solved - in the invoke() function, I set these:

self._initial_mouse = event.mouse_x
self._initial_frame = scene.frame_current

in modal():

self.offset = (self._initial_mouse - event.mouse_x) * -0.1
scene.frame_current = self._initial_frame + self.offset
| improve this answer | |

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.