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

Boudrey/maya 123462/pullset remove #2386

Merged
merged 3 commits into from
May 30, 2022
Merged
Changes from 2 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
22 changes: 22 additions & 0 deletions lib/mayaUsd/fileio/primUpdaterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,28 @@ bool PrimUpdaterManager::discardPrimEdits(const Ufe::Path& pulledPath)
return false;
}

// Discard of the pull set if it is empty.
Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk May 27, 2022

Choose a reason for hiding this comment

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

Should mergeToUsd also get rid of the set? IDK why the task only complained about discard... you did as the task specified, but ask Natalia if the set should also go away when the last edited prim is merged, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, easy to do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe Natalia wanted to keep the set around for some reason. I don't think so, but it would be good to confirm.

//
// Note: do not use the MFnSet API to discard it as it clears the redo stack
// and thus prevents redo.
MObject pullSetObj;
MStatus status = UsdMayaUtil::GetMObjectByName(kPullSetName, pullSetObj);
if (status == MStatus::kSuccess) {
MFnSet fnPullSet(pullSetObj);
MSelectionList members;
const bool flatten = true;
fnPullSet.getMembers(members, flatten);

if (members.length() == 0) {
MString deleteSetCmd;
deleteSetCmd.format(
"lockNode -lock off \"^1s\";delete \"^1s\";", kPullSetName.asChar());
MDGModifier& dgMod = MDGModifierUndoItem::create("Discard edits pull set removal");
dgMod.commandToExecute(deleteSetCmd);
dgMod.doIt();
}
}

auto ufeUsdItem = Ufe::Hierarchy::createItem(pulledPath);
auto hier = Ufe::Hierarchy::hierarchy(ufeUsdItem);
if (TF_VERIFY(hier)) {
Expand Down