bevy/crates
robtfm 3dc6a07d27
generic component propagation (#17575)
# Objective

add functionality to allow propagating components to children. requested
originally for `RenderLayers` but can be useful more generally.

## Solution

- add `HierarchyPropagatePlugin<C, F=()>` which schedules systems to
propagate components through entities matching `F`
- add `Propagate<C: Component + Clone + PartialEq>` which will cause `C`
to be added to all children
more niche features:
- add `PropagateStop<C>` which stops the propagation at this entity
- add `PropagateOver<C>` which allows the propagation to continue to
children, but doesn't add/remove/modify a `C` on this entity itself

## Testing

see tests inline

## Notes

- could happily be an out-of-repo plugin
- not sure where it lives: ideally it would be in `bevy_ecs` but it
requires a `Plugin` so I put it in `bevy_app`, doesn't really belong
there though.
- i'm not totally up-to-date on triggers and observers so possibly this
could be done more cleanly, would be very happy to take review comments
- perf: this is pretty cheap except for `update_reparented` which has to
check the parent of every moved entity. since the entirety is opt-in i
think it's acceptable but i could possibly use `(Changed<Children>,
With<Inherited<C>>)` instead if it's a concern
2025-06-06 00:02:02 +00:00
..
bevy_a11y bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_animation bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_anti_aliasing bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_app generic component propagation (#17575) 2025-06-06 00:02:02 +00:00
bevy_asset bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_audio bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_color bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_core_pipeline bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_derive bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_dev_tools bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_diagnostic bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_dylib bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_ecs bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_encase_derive bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_gilrs bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_gizmos bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_gltf bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_image bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_input bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_input_focus bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_internal bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_log bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_macro_utils bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_math bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_mesh bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_mikktspace bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_pbr bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_picking bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_platform bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_ptr bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_reflect bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_remote bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_render bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_scene bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_sprite bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_state bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_tasks bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_text bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_time bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_transform bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_ui bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_utils bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_window bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
bevy_winit bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00