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-123332 allow topological modifications #2363

Merged
merged 3 commits into from
May 19, 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
24 changes: 24 additions & 0 deletions lib/mayaUsd/fileio/primUpdaterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,26 @@ bool removeExcludeFromRendering(const Ufe::Path& ufePulledPath)
return true;
}

//------------------------------------------------------------------------------
//
// Turn on the mesh flag to allow topological modifications.
bool allowTopologyModifications(MDagPath& root)
{
MDGModifier& dgMod = MDGModifierUndoItem::create("Allow topology modifications");

MItDag dagIt;
dagIt.reset(root, MItDag::kDepthFirst, MFn::kMesh);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like a shame that LockNodesUndoItem does a traversal, then we do another traversal here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, but I did not see an elegant way out, especially since here we only need meshes.

for (; !dagIt.isDone(); dagIt.next()) {
MFnDependencyNode depNode(dagIt.item());
MPlug topoPlug = depNode.findPlug("allowTopologyMod");
if (topoPlug.isNull())
continue;
dgMod.newPlugValueBool(topoPlug, true);
}

return dgMod.doIt();
}

//------------------------------------------------------------------------------
//
// Perform the import step of the pull (first step), with the argument
Expand Down Expand Up @@ -967,6 +987,10 @@ bool PrimUpdaterManager::editAsMaya(const Ufe::Path& path, const VtDictionary& u
if (!updaterArgs._copyOperation) {
// Lock pulled nodes starting at the pull parent.
LockNodesUndoItem::lock("Edit as Maya node locking", pullParentPath, true);

// Allow editing topology, which gets turned of by locking.
if (!allowTopologyModifications(pullParentPath))
return false;
}

// We must recreate the UFE item because it has changed data models (USD -> Maya).
Expand Down