bevy/crates/bevy_app/src
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
..
app.rs Mention in .add_observer() docs that first parameter must be a Trigger (#19315) 2025-05-26 20:06:08 +00:00
hotpatch.rs Hot patching systems with subsecond (#19309) 2025-06-03 21:12:38 +00:00
lib.rs generic component propagation (#17575) 2025-06-06 00:02:02 +00:00
main_schedule.rs Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
panic_handler.rs bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
plugin_group.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
plugin.rs Update downcast-rs to version 2 (#17223) 2025-01-07 21:33:40 +00:00
propagate.rs generic component propagation (#17575) 2025-06-06 00:02:02 +00:00
schedule_runner.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
sub_app.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
task_pool_plugin.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
terminal_ctrl_c_handler.rs Renamed EventWriter::send methods to write. (#17977) 2025-02-23 21:18:52 +00:00