MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / FindNode

Method FindNode

src/engine/SceneGraph.cpp:913–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913std::shared_ptr<SceneGraphNode> SceneGraph::FindNode(const std::filesystem::path& path, SceneGraphNode* context) const
914{
915 auto pathComponent = path.begin();
916
917 if (pathComponent == path.end())
918 return nullptr;
919
920 if (*pathComponent == "/")
921 {
922 context = m_Root.get();
923 ++pathComponent;
924 }
925
926 if (!context)
927 {
928 log::error("Relative node queries with NULL context are not supported");
929 return nullptr;
930 }
931
932 SceneGraphNode* current = context;
933
934 while (current && pathComponent != path.end())
935 {
936 if (*pathComponent == "..")
937 {
938 current = current->GetParent();
939 ++pathComponent;
940 continue;
941 }
942
943 auto found = std::find_if(current->m_Children.begin(), current->m_Children.end(),
944 [&pathComponent](std::shared_ptr<SceneGraphNode> const& item) { return item->GetName() == *pathComponent; });
945
946 if (found != current->m_Children.end())
947 {
948 current = found->get();
949 ++pathComponent;
950 continue;
951 }
952
953 return nullptr;
954 }
955
956 return current->shared_from_this();
957}
958
959void SceneGraph::Refresh(uint32_t frameIndex)
960{

Callers 2

LoadSceneGraphMethod · 0.80
LoadAnimationsMethod · 0.80

Calls 5

errorFunction · 0.85
getMethod · 0.80
GetParentMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected