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

EMSUSD-998 better universal manip undo redo #3615

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

pierrebai-adsk
Copy link
Collaborator

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.

@pierrebai-adsk pierrebai-adsk added bug Something isn't working adsk Related to Autodesk plugin labels Feb 14, 2024
@pierrebai-adsk pierrebai-adsk self-assigned this Feb 14, 2024
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-998/better-universal-manip-undo-redo branch from d741212 to f0a5fd4 Compare February 15, 2024 13:55
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.
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-998/better-universal-manip-undo-redo branch from f0a5fd4 to 7302fd0 Compare February 15, 2024 14:49
@@ -479,32 +425,33 @@ UsdTransform3dMayaXformStack::rotateCmd(double x, double y, double z)
GfVec3f v(x, y, z);
CvtRotXYZToAttrFn cvt = hasRotate ? getCvtRotXYZToAttrFn(op.GetOpName()) : toXYZ;

Copy link
Collaborator Author

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.

Copy link
Collaborator

@AramAzhari-adsk AramAzhari-adsk left a comment

Choose a reason for hiding this comment

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

LGTM

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Feb 22, 2024
Copy link
Collaborator

@ppt-adsk ppt-adsk left a 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.
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit-pick: "exists" --> "exist".

Comment on lines +124 to +128
if (!_isPrepared)
return;

if (_opCreated)
return;
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit-pick: "manipualtion".

@seando-adsk seando-adsk added ufe Related to UFE component in Maya and removed bug Something isn't working adsk Related to Autodesk plugin labels Mar 8, 2024
@seando-adsk seando-adsk merged commit 859bef1 into dev Mar 8, 2024
11 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-998/better-universal-manip-undo-redo branch March 8, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe Related to UFE component in Maya
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants