7
$\begingroup$

I am making improvements to the VSE_Transform_Tools addon and I'd like to know if there is a way for me to use python to make the mouse jump to the other side of the screen when scaling or grabbing as seen in the 3d view:

enter image description here

Currently my addon does not have this behavior, as you can see:

enter image description here

$\endgroup$
2
  • $\begingroup$ If I may add I'm certain blender already does that. You shouldn't need to do anything with the code. $\endgroup$
    – Im Yonkers
    Jan 30, 2018 at 18:17
  • $\begingroup$ I have added another image to show how this is a problem for my addon. $\endgroup$
    – doakey3
    Jan 30, 2018 at 18:47

1 Answer 1

4
+100
$\begingroup$

Your operator should include the following in the bl_options:

  • GRAB_CURSOR to allow it to grab the mouse focus and
  • BLOCKING to prevent anything else from using the cursor

Like this:

bl_options = {'GRAB_CURSOR', 'BLOCKING'}

More info in the API documents.

As an example, you may see this in action in blender/2.79/scripts/addons/mesh_extra_tools.py

$\endgroup$
4
  • $\begingroup$ Nice find! This seems to be on the right track. There seems to be more to it than simply putting this in the bl_options line. The API says something about "enabling continuous grab". $\endgroup$
    – doakey3
    Jan 30, 2018 at 20:52
  • $\begingroup$ This option means that the mouse events will still be sent to the operator, even if the mouse leaves the current editor, but you still need to enable continuous grab in preferences>input. $\endgroup$
    – Secrop
    Jan 30, 2018 at 20:59
  • $\begingroup$ I tried to award you the bounty, but it says I have to wait 20 hours to do so. $\endgroup$
    – doakey3
    Jan 30, 2018 at 21:04
  • $\begingroup$ The "enabling continuous grab" sentence threw me off as well. Turns out all I was missing was to add BLOCKING. $\endgroup$
    – Zyl
    Aug 21, 2019 at 20:59

You must log in to answer this question.

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