Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap mouse for blender-style transforms. #59467

Merged
merged 1 commit into from Jul 12, 2023

Conversation

rcorre
Copy link
Contributor

@rcorre rcorre commented Mar 24, 2022

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.

ssr-2022-03-24_08.24.10.mp4

@rcorre rcorre requested a review from a team as a code owner March 24, 2022 12:52
@Calinou Calinou added this to the 4.0 milestone Mar 24, 2022
@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 9, 2023
@MewPurPur
Copy link
Contributor

poke poke?

@rcorre
Copy link
Contributor Author

rcorre commented May 31, 2023

Rebased to resolve conflicts, thanks for the reminder!

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 12, 2023
@YuriSizov
Copy link
Contributor

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.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works. Code looks good to me too.

@rcorre
Copy link
Contributor Author

rcorre commented Jun 14, 2023

Updated the comments. Thanks for the reviews!

@YuriSizov
Copy link
Contributor

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

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.
@YuriSizov
Copy link
Contributor

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.

@rcorre
Copy link
Contributor Author

rcorre commented Jul 10, 2023

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

@YuriSizov YuriSizov merged commit 56a1d51 into godotengine:master Jul 12, 2023
13 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@aidan-j-rhoden
Copy link

aidan-j-rhoden commented Jul 20, 2023

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.

Screen.Recording.2023-07-20.at.4.13.22.PM_1_1.mp4

Godot 4.2.dev1.official, MacOS Monterey 12.6.7, Intel Core i7-4770HQ

@rcorre rcorre deleted the blender-wrap branch July 21, 2023 14:52
@rcorre
Copy link
Contributor Author

rcorre commented Jul 21, 2023

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

@aidan-j-rhoden
Copy link

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!

@rcorre
Copy link
Contributor Author

rcorre commented Jul 21, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using blender-like transform operators, warp the mouse when reaching viewport edges
5 participants