Skip to content

Commit

Permalink
UFE v3/v4 compatibility fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
ppt-adsk committed Sep 12, 2022
1 parent 4da800c commit aa8b425
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/mayaUsd/fileio/orphanedNodesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ void OrphanedNodesManager::operator()(const Ufe::Notification& n)
// notifications.
if (auto objAdd = dynamic_cast<const Ufe::ObjectAdd*>(&sceneNotification)) {
handleOp(Ufe::SceneCompositeNotification::Op(
Ufe::SceneCompositeNotification::ObjectAdd, objAdd->item()));
Ufe::SceneCompositeNotification::OpType::ObjectAdd, objAdd->item()));
} else if (auto objDel = dynamic_cast<const Ufe::ObjectDelete*>(&sceneNotification)) {
handleOp(Ufe::SceneCompositeNotification::Op(
Ufe::SceneCompositeNotification::ObjectDelete, objDel->path()));
Ufe::SceneCompositeNotification::OpType::ObjectDelete, objDel->path()));
} else if (
auto subtrInv = dynamic_cast<const Ufe::SubtreeInvalidate*>(&sceneNotification)) {
handleOp(Ufe::SceneCompositeNotification::Op(
Ufe::SceneCompositeNotification::SubtreeInvalidate, subtrInv->root()));
Ufe::SceneCompositeNotification::OpType::SubtreeInvalidate, subtrInv->root()));
}
#endif
}
Expand Down Expand Up @@ -276,6 +276,7 @@ void OrphanedNodesManager::recursiveSetVisibility(
const Ufe::TrieNode<PullVariantInfo>::Ptr& trieNode,
bool visibility)
{
#if (UFE_PREVIEW_VERSION_NUM >= 4026)
// We know in our case that a trie node with data can't have children,
// since descendants of a pulled prim can't be pulled.
if (trieNode->hasData()) {
Expand All @@ -287,13 +288,15 @@ void OrphanedNodesManager::recursiveSetVisibility(
recursiveSetVisibility((*trieNode)[c], visibility);
}
}
#endif
}

/* static */
void OrphanedNodesManager::recursiveSwitch(
const Ufe::TrieNode<PullVariantInfo>::Ptr& trieNode,
const Ufe::Path& ufePath)
{
#if (UFE_PREVIEW_VERSION_NUM >= 4026)
// We know in our case that a trie node with data can't have children,
// since descendants of a pulled prim can't be pulled. A trie node with
// data is one that's been pulled.
Expand Down Expand Up @@ -334,6 +337,7 @@ void OrphanedNodesManager::recursiveSwitch(
}
}
}
#endif
}

/* static */
Expand Down Expand Up @@ -370,6 +374,7 @@ void OrphanedNodesManager::deepCopy(
const Ufe::TrieNode<PullVariantInfo>::Ptr& src,
const Ufe::TrieNode<PullVariantInfo>::Ptr& dst)
{
#if (UFE_PREVIEW_VERSION_NUM >= 4026)
for (const auto& c : src->childrenComponents()) {
const auto& srcChild = (*src)[c];
auto dstChild = std::make_shared<Ufe::TrieNode<PullVariantInfo>>(c);
Expand All @@ -379,6 +384,7 @@ void OrphanedNodesManager::deepCopy(
}
deepCopy(srcChild, dstChild);
}
#endif
}

} // namespace MAYAUSD_NS_DEF

0 comments on commit aa8b425

Please sign in to comment.