MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / findFirstPatch

Function findFirstPatch

test/algorithm/Scene.h:97–116  ·  view source on GitHub ↗

Finds the first matching child patch of the given parent node matching the given predicate

Source from the content-addressed store, hash-verified

95
96// Finds the first matching child patch of the given parent node matching the given predicate
97inline scene::INodePtr findFirstPatch(const scene::INodePtr& parent,
98 const std::function<bool(const IPatchNodePtr&)>& predicate)
99{
100 scene::INodePtr candidate;
101
102 parent->foreachNode([&](const scene::INodePtr& node)
103 {
104 auto patchNode = std::dynamic_pointer_cast<IPatchNode>(node);
105
106 if (!candidate && patchNode && predicate(patchNode))
107 {
108 candidate = node;
109 return false;
110 }
111
112 return true;
113 });
114
115 return candidate;
116}
117
118// Finds the first matching child patch of the given parent node, with the given material
119inline scene::INodePtr findFirstPatchWithMaterial(const scene::INodePtr& parent, const std::string& material)

Callers 2

TEST_FFunction · 0.85

Calls 1

foreachNodeMethod · 0.45

Tested by

no test coverage detected