Skip to main content

HierarchyPropagationSystem Class

Propagates activation state from parent to child entities. More...

Declaration

class helios::engine::ecs::systems::HierarchyPropagationSystem { ... }

Public Member Typedefs Index

usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept

Processes hierarchy propagation for dirty root entities. More...

Private Member Functions Index

voidupdateEntityHierarchy (GameObject go, helios::engine::runtime::world::UpdateContext &updateContext, bool active)

Recursively updates activation state for an entity and its children. More...

Private Member Attributes Index

std::vector< GameObject >roots_

Temporary storage for root entities pending propagation. More...

Description

Propagates activation state from parent to child entities.

This system processes entities with HierarchyComponent and propagates their active/inactive state to all descendants. Only root entities (those without a parent) that are marked dirty trigger propagation.

The system runs in two passes:

  • Active roots: propagate active state to children
  • Inactive roots: propagate inactive state to children

Definition at line 47 of file HierarchyPropagationSystem.ixx.

Public Member Typedefs

EngineRoleTag

using helios::engine::ecs::systems::HierarchyPropagationSystem::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Member Functions

update()

void helios::engine::ecs::systems::HierarchyPropagationSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Processes hierarchy propagation for dirty root entities.

Parameters
updateContext

The current frame's update context.

Definition at line 84 of file HierarchyPropagationSystem.ixx.

85
86 for (auto [entity, hc, active] : updateContext.view<
89 >().whereEnabled()) {
90 if (hc->parent() || !hc->isDirty()) {
91 continue;
92 }
93 roots_.push_back(entity);
94 }
95
96 for (auto& entity : roots_) {
97 updateEntityHierarchy(entity, updateContext, true);
98 }
99 roots_.clear();
100
101 for (auto [entity, hc, active] : updateContext.view<
104 >().whereEnabled()) {
105 if (hc->parent() || !hc->isDirty()) {
106 continue;
107 }
108 roots_.push_back(entity);
109 }
110
111 for (auto& entity : roots_) {
112 updateEntityHierarchy(entity, updateContext, false);
113 }
114 roots_.clear();
115 }

Reference helios::engine::runtime::world::UpdateContext::view.

Private Member Functions

updateEntityHierarchy()

void helios::engine::ecs::systems::HierarchyPropagationSystem::updateEntityHierarchy (GameObject go, helios::engine::runtime::world::UpdateContext & updateContext, bool active)
inline

Recursively updates activation state for an entity and its children.

Parameters
go

The entity to update.

active

The activation state to apply.

Definition at line 55 of file HierarchyPropagationSystem.ixx.

55 void updateEntityHierarchy(GameObject go, helios::engine::runtime::world::UpdateContext& updateContext, bool active) {
56
58 if (!hc) {
59 return;
60 }
61 hc->clearDirty();
62 for (auto child : hc->children()) {
63 if (auto ent = updateContext.find(child)) {
64 ent->setActive(active);
65 updateEntityHierarchy(ent.value(), updateContext, active);
66 }
67 }
68 }

Private Member Attributes

roots_

std::vector<GameObject> helios::engine::ecs::systems::HierarchyPropagationSystem::roots_

Temporary storage for root entities pending propagation.

Definition at line 73 of file HierarchyPropagationSystem.ixx.

73 std::vector<GameObject> roots_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.