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

Added 2D support through axis masking (Issue #49) #316

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

Batres3
Copy link
Contributor

@Batres3 Batres3 commented Nov 9, 2023

I added a function void SetAxisMask(bool x, bool y, bool z) which allows the user to permanently hide whichever axis is set to true, multiple axes can be hidden (although it's kind of pointless).
As suggested in Issue #49, I used the belowAxisLimit boolean to hide the given axes for translation and scale, for rotation, however, the DrawRotationGizmo function was edited in order to show the rotation widget on whichever plane is perpendicular to the masked axis (no widget is shown if 2 or more axes are masked), the same was done for plane movement with the translation gizmo. Aditionally, in the case of MT_ROTATE_SCREEN, it is completely removed should any axis be masked (It didn't make much sense to me to be able to rotate it in any given direction when it's supposed to be masked), however both MT_SCALE_XYZ and 'MT_MOVE_SCREEN' were left as is (It made more sense for these to have an "override" of sorts, but that's just personal opinion)

I'm quite new to ImGuizmo and did this for a personal project and thought it could be handy, which is why I made a pull request, but since I'm not very familiar with it I may have put the checks for masking in suboptimal places, however I believe the checks themselves are quite efficient since they consist solely of bit operations.

Keep in mind I have NOT tested this as thoroughly as I probably should have, and it may cause unforseen issues, but for my personal usecase it seems to cause no problems

@CedricGuillemet CedricGuillemet merged commit ef43b54 into CedricGuillemet:master Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants