Added Scene Init Exit events #291

Merged
maverickdgg merged 6 commits from SP3-12-SceneGraph into main 2022-12-06 13:39:58 +08:00
2 changed files with 18 additions and 6 deletions
Showing only changes of commit 807ad54d7d - Show all commits

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
{
active = newActiveState;
for (auto* child : children)
{
child->SetActive(newActiveState);
}
}
} // namespace SHADE