-
Notifications
You must be signed in to change notification settings - Fork 202
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
EMSUSD-998 better universal manip undo redo #3615
EMSUSD-998 better universal manip undo redo #3615
Conversation
d741212
to
f0a5fd4
Compare
Fix the complicated handling of undo and redo vs the universal manipulator. The code failed to do the right thing when half of the attributes are already existed or when more complex composite manipulations were done, for example when scaling with the universal manipulator. We make the transformation commands more robust vs the ordering of calls to support all use cases. They still handle the bug related to object-space translation redo: when redoing an object-space translation, Maya passes in incorrect values to the command that must be ignored. Apply fix to all transform commands. This way they all use the same pattern from UsdSetXformOpUndoableCommandBase to manage any order of calls to execute/set/undo/redo: use in the CommonAPI commands, matrix commands and Maya tranform-stack commands.
f0a5fd4
to
7302fd0
Compare
@@ -479,32 +425,33 @@ UsdTransform3dMayaXformStack::rotateCmd(double x, double y, double z) | |||
GfVec3f v(x, y, z); | |||
CvtRotXYZToAttrFn cvt = hasRotate ? getCvtRotXYZToAttrFn(op.GetOpName()) : toXYZ; | |||
|
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.
For the changes below, I suggest you "Hide whitespace" in the diff preferences, under the cog at the top of the review page.
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.
LGTM
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.
Looks good to me, not an easy problem to tackle cleanly because of Maya idiosyncrasies.
if (!_isPrepared) | ||
return; | ||
|
||
// Restore the initial value and potentially remove the creatd attributes. |
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.
Nit-pick: "creatd"
_newOpValue = v; | ||
|
||
// Set the new value, potentially creating the attribute if it | ||
// did not exists or caching the initial value if this is the |
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.
Nit-pick: "exists" --> "exist".
if (!_isPrepared) | ||
return; | ||
|
||
if (_opCreated) | ||
return; |
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 feels like you're going from a unique _state description to multiple booleans, which I'm not crazy about. Representing state uniquely and having clear transitions from one state to another usually helps maintainability, but I trust you on this one.
// undo an attribute creation if it was not yet created. | ||
// | ||
// - Maya can call undo and set-value before first executing the | ||
// command. In particular, when using manipualtion tools, Maya |
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.
Nit-pick: "manipualtion".
Fix the complicated handling of undo and redo vs the universal manipulator. The code failed to do the right thing when half of the attributes are already existed or when more complex composite manipulations were done, for example when scaling with the universal manipulator.
We make the transformation commands more robust vs the ordering of calls to support all use cases. They still handle the bug related to object-space translation redo: when redoing an object-space translation, Maya passes in incorrect values to the command that must be ignored.
Apply fix to all transform commands. This way they all use the same pattern from UsdSetXformOpUndoableCommandBase to manage any order of calls to execute/set/undo/redo: use in the CommonAPI commands, matrix commands and Maya tranform-stack commands.