Merge pull request #48 from SHADE-DP/SP3-16-Math
SP3-16 Transform System Hotfix
This commit is contained in:
commit
6848672899
|
@ -66,17 +66,8 @@ namespace SHADE
|
||||||
|
|
||||||
for (const auto* child : node->GetChildren())
|
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());
|
const bool HAS_TRANSFORM = SHComponentManager::HasComponent<SHTransformComponent>(child->GetEntityID());
|
||||||
if (!HAS_TRANSFORM)
|
if (!HAS_TRANSFORM)
|
||||||
|
@ -84,8 +75,13 @@ namespace SHADE
|
||||||
|
|
||||||
auto* childTransform = SHComponentManager::GetComponent<SHTransformComponent>(child->GetEntityID());
|
auto* childTransform = SHComponentManager::GetComponent<SHTransformComponent>(child->GetEntityID());
|
||||||
|
|
||||||
|
// 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)
|
if (childTransform->dirty || HAS_PARENT_CHANGED)
|
||||||
UpdateTransform(*childTransform, NODE_TRANSFORM);
|
UpdateTransform(*childTransform, NODE_TRANSFORM);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateEntity(child);
|
UpdateEntity(child);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue