Fixed Scene Node SetActive & SceneGraph CheckActiveInHierarchy
This commit is contained in:
parent
0bf549f478
commit
807ad54d7d
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue