@@ -4810,6 +4810,9 @@ ecs_table_t* flecs_bootstrap_component_table(
48104810 world->cr_childof_0 = flecs_components_ensure(world,
48114811 ecs_pair(EcsChildOf, 0));
48124812
4813+ cr = flecs_components_ensure(world, ecs_id(EcsParent));
4814+ cr->flags |= EcsIdHasOnSet;
4815+
48134816 /* Initialize root table */
48144817 flecs_init_root_table(world);
48154818
@@ -7345,8 +7348,7 @@ void flecs_notify_on_set(
73457348 ecs_iter_action_t on_set = ti->hooks.on_set;
73467349 if (on_set) {
73477350 ecs_table_record_t dummy_tr;
7348- const ecs_table_record_t *tr =
7349- flecs_component_get_table(cr, table);
7351+ const ecs_table_record_t *tr = flecs_component_get_table(cr, table);
73507352 if (!tr) {
73517353 dummy_tr.hdr.cr = cr;
73527354 dummy_tr.hdr.table = table;
@@ -7370,7 +7372,6 @@ void flecs_notify_on_set(
73707372 }
73717373 }
73727374
7373- /* Run OnSet notifications */
73747375 if ((dont_fragment || table->flags & EcsTableHasOnSet)) {
73757376 ecs_type_t ids = { .array = &id, .count = 1 };
73767377 flecs_emit(world, world, &(ecs_event_desc_t) {
@@ -15531,15 +15532,15 @@ void flecs_emit(
1553115532 * event) this will cause the components of the target entity to be
1553215533 * propagated to the source entity. This makes it possible for observers to
1553315534 * get notified of any new reachable components though the relationship. */
15534- bool can_forward = event != EcsOnSet ;
15535+ bool can_forward = true ;
1553515536
1553615537 /* Does table has observed entities */
1553715538 bool has_observed = table_flags & EcsTableHasTraversable;
1553815539
1553915540 ecs_event_id_record_t *iders[5] = {0};
1554015541 ecs_table_record_t dummy_tr;
1554115542
15542- if (count && can_forward && has_observed) {
15543+ if (count && has_observed) {
1554315544 flecs_emit_propagate_invalidate(world, table, offset, count);
1554415545 }
1554515546
@@ -15567,14 +15568,27 @@ void flecs_emit(
1556715568 continue;
1556815569 }
1556915570
15571+ // if (id == ecs_id(EcsParent)) {
15572+
15573+ // ecs_event_desc_t pdesc = *desc;
15574+ // EcsParent *parents = ecs_table_get_column(table,
15575+ // table->component_map[ecs_id(EcsParent)], it.offset);
15576+ // int32_t i, count = pdesc.count;
15577+
15578+ // for (i = 0; i < count; i ++) {
15579+ // ecs_entity_t parent =
15580+
15581+ // }
15582+ // }
15583+
1557015584 int32_t ider_i, ider_count = 0;
1557115585 ecs_component_record_t *cr = flecs_components_get(world, id);
1557215586 ecs_assert(cr != NULL, ECS_INTERNAL_ERROR, NULL);
1557315587 ecs_flags32_t cr_flags = cr->flags;
1557415588
1557515589 /* Check if this id is a pair of an traversable relationship. If so, we
1557615590 * may have to forward ids from the pair's target. */
15577- if (can_forward && (cr_flags & EcsIdTraversable)) {
15591+ if (can_forward && ECS_IS_PAIR(id) && (cr_flags & EcsIdTraversable)) {
1557815592 const ecs_event_record_t *er_fwd = NULL;
1557915593 if (ECS_PAIR_FIRST(id) == EcsIsA) {
1558015594 if (event == EcsOnAdd) {
@@ -15609,6 +15623,7 @@ void flecs_emit(
1560915623
1561015624 /* Forward events for components from pair target */
1561115625 flecs_emit_forward(world, er, er_fwd, ids, &it, table, cr);
15626+
1561215627 ecs_assert(it.event_cur == evtx, ECS_INTERNAL_ERROR, NULL);
1561315628 }
1561415629
@@ -38152,6 +38167,10 @@ ecs_flags32_t flecs_component_get_flags_intern(
3815238167 result |= EcsIdSingleton;
3815338168 }
3815438169
38170+ if (id == ecs_id(EcsParent)) {
38171+ result |= EcsIdTraversable;
38172+ }
38173+
3815538174 ecs_entity_t on_delete_kind = ecs_table_get_target(world, table, EcsOnDelete, 0);
3815638175 if (on_delete_kind == EcsRemove) {
3815738176 result |= EcsIdOnDeleteRemove;
0 commit comments