returning node descendant by name

This commit is contained in:
devZoGok
2024-06-25 19:45:59 +03:00
parent 09246fb265
commit 82d1afa87c
2 changed files with 16 additions and 0 deletions
+15
View File
@@ -422,6 +422,21 @@ namespace vb01{
return origin;
}
Node* Node::findDescendant(string name, bool allDescendants){
vector<Node*> descendants = children;
if(allDescendants){
descendants.clear();
getDescendants(descendants);
}
for(Node *desc : descendants)
if(desc->getName() == name)
return desc;
return nullptr;
}
void Node::updateShaders(){
Root *root = Root::getSingleton();