-
Notifications
You must be signed in to change notification settings - Fork 88
Fixed visual issue when selecting and moving a face that was grouped in the UV window #631
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
base: master
Are you sure you want to change the base?
Conversation
… then moving it. this was due to bad handle position set, which would then overwrite the uv center badly. this only happens in the editor, not with the API
|
varinotmUnity seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent |
| // Simulate a move operation | ||
| Vector2 moveDelta = new Vector2(0.1f, 0.2f); | ||
| UVEditor.instance.SceneMoveTool(moveDelta); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The new tests MoveSingleFace_PreservesRelativePositions and MoveConnectedFaces_PreservesRelativePositions are missing a call to OnBeginUVModification() before SceneMoveTool(). The bug fix in this PR is located within OnBeginUVModification, which handles auto-selecting grouped faces and preserving the handle position. Without this call, the tests do not accurately simulate the user workflow and fail to validate the actual fix. [possible issue, importance: 9]
| // Simulate a move operation | |
| Vector2 moveDelta = new Vector2(0.1f, 0.2f); | |
| UVEditor.instance.SceneMoveTool(moveDelta); | |
| // Simulate a move operation | |
| Vector2 moveDelta = new Vector2(0.1f, 0.2f); | |
| UVEditor.instance.OnBeginUVModification(); | |
| UVEditor.instance.SceneMoveTool(moveDelta); |
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SceneModeTool called OnBeginModification already
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## master #631 +/- ##
==========================================
+ Coverage 35.55% 36.02% +0.47%
==========================================
Files 277 277
Lines 34889 34888 -1
==========================================
+ Hits 12406 12570 +164
+ Misses 22483 22318 -165
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
| m_cube = null; | ||
|
|
||
| // Clear undo to prevent resurrection | ||
| Undo.ClearAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the cube was not getting deleted at the end of the test. the changes here is to clean the test. only this line was necessary to fix the issue though
| get { return Event.current.modifiers == EventModifiers.Control; } | ||
| get { return EditorGUI.actionKey; } | ||
| } | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was changed or else the test would not pass
DO NOT FORGET TO INCLUDE A CHANGELOG ENTRY
Purpose of this PR
Fix UV Editor distortion when dragging connected texture group faces
Problem
When you select one face in a subdivided/connected texture group and drag it in the UV Editor, all connected faces would visually jump/distort during the drag. On mouse release everything snaps back to correct position, so it's visual bug only.
Root Cause
OnBeginUVModification()auto-selects all faces in the texture group, then calculates new pivot as center of ALL faces. The move math then reprojects each vertex relative to this new center, causing the visual jump.Fix
Store
handlePositionBEFORE the texture group auto-selection loop runs. Use this original position asuvOrigininstead of the recalculated center.This way connected faces maintain their spatial relationship to the original pivot point, meaning no distortion.
Changes
UVEditor.cs: Save original handle position beforeSelectTextureGroups(), use it foruvOriginEditorGUI.actionKeyinstead of platform-specific Control/Command key check. This is only because Unit tests were failing.MoveSingleFace_PreservesRelativePositions()andMoveConnectedFaces_PreservesRelativePositions()to verify no distortion happens. The unit tests do not test the original issue, as it is ONLY happening in the editor UV window. The editor calls MoveTool(), while the unit tests calls SceneMoveTool. The tests were mostly added to make sure I didn't break the API.Links
https://jira.unity3d.com/browse/PBLD-276
Comments to Reviewers
Though I did not test what would happen with the rotate and scale tool. From my testing, it looks fine, but thorough testing from QA might be necessary to make sure we don't cause regression