Wrap mouse for blender-style transforms.
When performing a blender-style translate or scale (but not rotate), wrap the mouse inside the bounds of the viewport. This allows moving the mouse indefinitely for large translate or scale operations, and is consistent with how blender works.
This enables global input processing during blender-style transforms, so we can capture and wrap mouse events outside the bounds of the viewport.
Other wrapping operations use _sinput, which I assume is possible because a mouse button is held, so the control receives input even when the mouse exits the control.
This does not implement wrapping for regular (gizmo-driven) transforms, though this could be done if desired.
Fixes godotengine/godot-proposals#4255.
https://user-images.githubusercontent.com/2496231/159920287-3014d4a0-e96a-416e-8bac-a7ba109df8c0.mp4
poke poke?
Rebased to resolve conflicts, thanks for the reminder!
This should be good for 4.2, I think, but it's too late for 4.1 at this point.
Also, could you fix the style of the code comments that you've added. They all should start with a capital letter and end with a period.
Updated the comments. Thanks for the reviews!
I think you need to do a rebase to fix that issue with a test on CI.
Sorry for this being quite a journey :) It looks good to go now, but we'll merge it a bit later, once we start merging 4.2-facing PRs.
No worries, thanks for reviewing it! 4.2 sounds good.
Thanks!
This doesn't seem to work for me on my Mac; perhaps I am missing something? Although it's not shown in the recording, I did use both the regular gizmo and the Move Mode.
https://github.com/godotengine/godot/assets/70079907/3eca06e2-7ba9-4501-8057-fa4b10f90f25
Godot 4.2.dev1.official, MacOS Monterey 12.6.7, Intel Core i7-4770HQ
@aidan-j-rhoden are you using blender-style transforms (e.g. "Begin Translate Transformation")? This was implemented only for those, not gizmo-driven transforms, as noted in the commit:
This does not implement wrapping for regular (gizmo-driven) transforms, though this could be done if desired.
I was not aware of blender-style transforms in Godot, only the gizmo transforms. So it seems that I missed the intended use. Sorry about that!
If it's not too much trouble, however, do you think you could implement the mouse wrapping for the regular gizmo transforms too? I love that feature in Blender, as it makes the experience a lot smoother and easier to work with. Again, sorry about the misunderstanding, and thank you for your work and time!
No worries! If I remember it would have been pretty simple to implement for both, I just wasn't sure if that was the desired behavior. I can take a look in a few days.