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();
+1
View File
@@ -45,6 +45,7 @@ namespace vb01{
Quaternion globalToLocalOrientation(Quaternion);
Vector3 localToGlobalScale(Vector3);
Vector3 globalToLocalScale(Vector3);
Node* findDescendant(std::string, bool=false);
inline void dettachMesh(int id){meshes.erase(meshes.begin() + id);}
inline Skeleton* getSkeleton(int i){return skeletons[i];}
inline int getNumSkeletons(){return skeletons.size();}