Fixed Scene Node SetActive & SceneGraph CheckActiveInHierarchy

This commit is contained in:
Diren D Bharwani 2022-11-22 21:31:37 +08:00
parent 0bf549f478
commit 807ad54d7d
2 changed files with 18 additions and 6 deletions

View File

@ -204,7 +204,24 @@ namespace SHADE
} }
//////////////////////////////////////// ////////////////////////////////////////
return NODE_ITER->second->IsActive(); // Recurse up the tree until the root. If any parent is inactive, this node is inactive in the hierarchy.
const SHSceneNode* PARENT_NODE = NODE_ITER->second->parent;
while (PARENT_NODE->GetEntityID() != root->GetEntityID())
{
if (!PARENT_NODE->IsActive())
return false;
if (!PARENT_NODE->parent)
{
SHLOGV_ERROR("Entity {}'s node that is not the root has no parent!", PARENT_NODE->GetEntityID())
return false;
}
PARENT_NODE = PARENT_NODE->parent;
}
return true;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/

View File

@ -133,11 +133,6 @@ namespace SHADE
void SHSceneNode::SetActive(bool newActiveState) noexcept void SHSceneNode::SetActive(bool newActiveState) noexcept
{ {
active = newActiveState; active = newActiveState;
for (auto* child : children)
{
child->SetActive(newActiveState);
}
} }
} // namespace SHADE } // namespace SHADE