diff --git a/lib/mayaUsd/fileio/primUpdaterManager.cpp b/lib/mayaUsd/fileio/primUpdaterManager.cpp index 86c28ac220..fd0aaa53d6 100644 --- a/lib/mayaUsd/fileio/primUpdaterManager.cpp +++ b/lib/mayaUsd/fileio/primUpdaterManager.cpp @@ -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(); @@ -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(); diff --git a/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp b/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp index 97353ab33b..4f7761ee35 100644 --- a/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp +++ b/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp @@ -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