Merge branch 'main' into SP3-10-input-management

This commit is contained in:
mushgunAX 2022-09-23 17:59:30 +08:00
commit 3ed1034e62
1 changed files with 9 additions and 13 deletions

View File

@ -66,17 +66,8 @@ namespace SHADE
for (const auto* child : node->GetChildren())
{
// Active states of entities should sync with scene nodes
const bool IS_NODE_ACTIVE = child->IsActive();
#ifdef _DEBUG
const bool IS_ENTITY_ACTIVE = SHEntityManager::GetEntityByID(child->GetEntityID())->GetActive();
SHASSERT(IS_NODE_ACTIVE == IS_ENTITY_ACTIVE, "Entity and Node active states are not synced!")
#endif
// Anything below is inactive
if (!IS_NODE_ACTIVE)
break;
const bool HAS_TRANSFORM = SHComponentManager::HasComponent<SHTransformComponent>(child->GetEntityID());
if (!HAS_TRANSFORM)
@ -84,8 +75,13 @@ namespace SHADE
auto* childTransform = SHComponentManager::GetComponent<SHTransformComponent>(child->GetEntityID());
if (childTransform->dirty || HAS_PARENT_CHANGED)
UpdateTransform(*childTransform, NODE_TRANSFORM);
// Only update if node in hierarchy and component are both active
const bool IS_NODE_ACTIVE = child->IsActive();
if (IS_NODE_ACTIVE && childTransform->isActive)
{
if (childTransform->dirty || HAS_PARENT_CHANGED)
UpdateTransform(*childTransform, NODE_TRANSFORM);
}
UpdateEntity(child);