pub struct HierarchyPropagatePlugin<C: Component + Clone + PartialEq, F: QueryFilter = (), R: Relationship = ChildOf> { /* private fields */ }
Expand description
Plugin to automatically propagate a component value to all direct and transient relationship
targets (e.g. bevy_ecs::hierarchy::Children
) of entities with a Propagate
component.
The plugin Will maintain the target component over hierarchy changes, adding or removing
C
when a relationship R
(e.g. ChildOf
) is added to or removed from a
relationship tree with a Propagate<C>
source, or if the Propagate<C>
component
is added, changed or removed.
Optionally you can include a query filter F
to restrict the entities that are updated.
Note that the filter is not rechecked dynamically: changes to the filter state will not be
picked up until the Propagate
component is touched, or the hierarchy is changed.
All members of the tree between source and target must match the filter for propagation
to reach a given target.
Individual entities can be skipped or terminate the propagation with the PropagateOver
and PropagateStop
components.
The schedule can be configured via HierarchyPropagatePlugin::new
.
You should be sure to schedule your logic relative to this set: making changes
that modify component values before this logic, and reading the propagated
values after it.
Implementations§
Source§impl<C: Component + Clone + PartialEq, F: QueryFilter, R: Relationship> HierarchyPropagatePlugin<C, F, R>
impl<C: Component + Clone + PartialEq, F: QueryFilter, R: Relationship> HierarchyPropagatePlugin<C, F, R>
Sourcepub fn new(schedule: impl ScheduleLabel) -> Self
pub fn new(schedule: impl ScheduleLabel) -> Self
Construct the plugin. The propagation systems will be placed in the specified schedule.
Trait Implementations§
Source§impl<C: Component + Clone + PartialEq, F: QueryFilter + 'static, R: Relationship> Plugin for HierarchyPropagatePlugin<C, F, R>
impl<C: Component + Clone + PartialEq, F: QueryFilter + 'static, R: Relationship> Plugin for HierarchyPropagatePlugin<C, F, R>
Source§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
finish
should be called.Source§fn finish(&self, _app: &mut App)
fn finish(&self, _app: &mut App)
App
, once all plugins registered are ready. This can
be useful for plugins that depends on another plugin asynchronous setup, like the renderer.Source§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Auto Trait Implementations§
impl<C, F, R> Freeze for HierarchyPropagatePlugin<C, F, R>
impl<C, F = (), R = ChildOf> !RefUnwindSafe for HierarchyPropagatePlugin<C, F, R>
impl<C, F, R> Send for HierarchyPropagatePlugin<C, F, R>
impl<C, F, R> Sync for HierarchyPropagatePlugin<C, F, R>
impl<C, F, R> Unpin for HierarchyPropagatePlugin<C, F, R>
impl<C, F = (), R = ChildOf> !UnwindSafe for HierarchyPropagatePlugin<C, F, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.