Skip to content

Commit

Permalink
Merge pull request #3198 from Autodesk/bailp/EMSUSD-190/lost-light
Browse files Browse the repository at this point in the history
EMSUSD-190 fix for lights after edit-as-Maya
  • Loading branch information
seando-adsk authored Jul 11, 2023
2 parents a1c54f4 + 6025f14 commit 3d59458
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
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 the default parent
// 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 parent();
}

#endif // UFE_V2_FEATURES_AVAILABLE
Expand Down

0 comments on commit 3d59458

Please sign in to comment.