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

MAYA-121532 push/pull: usdeditAsMaya set should be a locked node #2290

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/mayaUsd/fileio/primUpdaterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,9 @@ PullImportPaths pullImport(
MStatus status = UsdMayaUtil::GetMObjectByName(kPullSetName, pullSetObj);
if (status != MStatus::kSuccess) {
MString createSetCmd;
createSetCmd.format("sets -em -name \"^1s\";", kPullSetName.asChar());
MDGModifier& dgMod = MDGModifierUndoItem::create("Pull import pull set creation");
createSetCmd.format("sets -em -name \"^1s\";lockNode \"^1s\";", kPullSetName.asChar());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to be working with the tests I did, but is it ok for the undo/rebo?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It depends if the command itself is undoable. The docs for MDGModifier says:

The command should be fully undoable, otherwise unpredictable behaviour
may result. For example, assume that the command is a MEL procedure
which contains some undoable commands and some non-undoable commands.
When doIt() is first called, the procedure will be executed and all of
its commands will take effect. If undoIt() is subsequently called, only
the undoable portions of the script will be undone, which may leave Maya
in an unstable or inconsistent state. Any subsequent calls to doIt() will
only redo the commands which were undone, the non-undoable portions
will not be re-executed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be hard to test it anyway, since the undo will delete the set, so you cannot check if it unlocked properly, but then it does not matter since the set is gone, so it should be fine. If the units tests about undo/redo of editAsMaya pass, then it should be fine.

MDGModifier& dgMod
= MDGModifierUndoItem::create("Pull import pull set creation and lock");
dgMod.commandToExecute(createSetCmd);
dgMod.doIt();
}
Expand Down