diff --git a/SHADE_Engine/src/Scene/SHSceneGraph.cpp b/SHADE_Engine/src/Scene/SHSceneGraph.cpp index 6240b7bf..5e9f331d 100644 --- a/SHADE_Engine/src/Scene/SHSceneGraph.cpp +++ b/SHADE_Engine/src/Scene/SHSceneGraph.cpp @@ -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; } /*-----------------------------------------------------------------------------------*/ diff --git a/SHADE_Engine/src/Scene/SHSceneNode.cpp b/SHADE_Engine/src/Scene/SHSceneNode.cpp index 8dac20bd..28f47989 100644 --- a/SHADE_Engine/src/Scene/SHSceneNode.cpp +++ b/SHADE_Engine/src/Scene/SHSceneNode.cpp @@ -133,11 +133,6 @@ namespace SHADE void SHSceneNode::SetActive(bool newActiveState) noexcept { active = newActiveState; - - for (auto* child : children) - { - child->SetActive(newActiveState); - } } } // namespace SHADE \ No newline at end of file