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-190 fix for lights after edit-as-Maya #3198

Merged
merged 6 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/mayaUsd/fileio/primUpdaterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ bool PrimUpdaterManager::mergeToUsd(
auto ufeUsdItem = Ufe::Hierarchy::createItem(pulledPath.pop());
auto hier = Ufe::Hierarchy::hierarchy(ufeUsdItem);
if (TF_VERIFY(hier)) {
scene.notify(Ufe::SubtreeInvalidate(hier->defaultParent()));
scene.notify(Ufe::SubtreeInvalidate(hier->parent()));
}
progressBar.advance();

Expand Down Expand Up @@ -1401,7 +1401,7 @@ bool PrimUpdaterManager::discardPrimEdits(const Ufe::Path& pulledPath)
auto ufeUsdItem = Ufe::Hierarchy::createItem(pulledPath);
auto hier = Ufe::Hierarchy::hierarchy(ufeUsdItem);
if (TF_VERIFY(hier)) {
scene.notify(Ufe::SubtreeInvalidate(hier->defaultParent()));
scene.notify(Ufe::SubtreeInvalidate(hier->parent()));
}
progressBar.advance();

Expand Down
21 changes: 17 additions & 4 deletions lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,23 @@ ProxyShapeHierarchy::reorderCmd(const Ufe::SceneItemList& orderedList) const

Ufe::SceneItem::Ptr ProxyShapeHierarchy::defaultParent() const
{
// The default parent is the root of the USD scene.
// Since the proxy shape corresponds to the USD root prim,
// therefore we implement the default parent as the proxy shape itself.
return UsdSceneItem::create(sceneItem()->path(), getUsdRootPrim());
// The documentation for defaultParent() stipulate that it should return
// where this node should be inserted to be added back. The proxy shape need
// to be inserted under its Maya shape node, which is its default parent,
// so we return that.
//
// It used to return the USD virtual root prim, but that caused problem since
// the UFE path pointed to a Maya node (the proxy shape) and teh default parent
pierrebai-adsk marked this conversation as resolved.
Show resolved Hide resolved
// was a USD object, leading to a contradiction. In particular, it became
// impossible to create a UFE Hiearchy interface from that default parent: its
// path indicated it was in the Maya run-time, yet its scene item claimed to
// be in the USD run-time.
//
// As far as I can tell, the defaultParent function is only used when reparenting
// nodes that lacked a parent, to figure a default location where to insert them.
//
// The PrimUpdaterManager also used to call it, but it no longer does.
return fMayaHierarchy->defaultParent();
}

#endif // UFE_V2_FEATURES_AVAILABLE
Expand Down