godot icon indicating copy to clipboard operation
godot copied to clipboard

Wrap mouse for blender-style transforms.

Open rcorre opened this issue 3 years ago • 7 comments

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

rcorre avatar Mar 24 '22 12:03 rcorre

poke poke?

MewPurPur avatar May 31 '23 05:05 MewPurPur

Rebased to resolve conflicts, thanks for the reminder!

rcorre avatar May 31 '23 11:05 rcorre

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.

YuriSizov avatar Jun 12 '23 13:06 YuriSizov

Updated the comments. Thanks for the reviews!

rcorre avatar Jun 14 '23 10:06 rcorre

I think you need to do a rebase to fix that issue with a test on CI.

YuriSizov avatar Jul 07 '23 13:07 YuriSizov

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.

YuriSizov avatar Jul 10 '23 10:07 YuriSizov

No worries, thanks for reviewing it! 4.2 sounds good.

rcorre avatar Jul 10 '23 10:07 rcorre

Thanks!

YuriSizov avatar Jul 12 '23 15:07 YuriSizov

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 avatar Jul 20 '23 21:07 aidan-j-rhoden

@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.

rcorre avatar Jul 21 '23 14:07 rcorre

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!

aidan-j-rhoden avatar Jul 21 '23 15:07 aidan-j-rhoden

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.

rcorre avatar Jul 21 '23 15:07 rcorre