Finds the first matching child patch of the given parent node matching the given predicate
| 95 | |
| 96 | // Finds the first matching child patch of the given parent node matching the given predicate |
| 97 | inline 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 |
| 119 | inline scene::INodePtr findFirstPatchWithMaterial(const scene::INodePtr& parent, const std::string& material) |
no test coverage detected