[−][src]Struct specs_hierarchy::Hierarchy
Scene graph type hierarchy.
Will use the given generic type P
as the component type that provides parenting links. The
internal structure is kept in sync with the Tracked
events for that component type.
Will send modification events on the internal EventChannel
. Note that Removed
events
do not indicate that the Parent
component was removed from the component storage, just that
the Entity
will no longer be considered to be a part of the Hierarchy
. This is because the
user may wish to either remove only the component, or the complete Entity, or something
completely different. When an Entity
that is a parent gets removed from the hierarchy, the
full tree of children below it will also be removed from the hierarchy.
Any cycles in the hierarchy will cause Undefined Behavior.
Methods
impl<P> Hierarchy<P>
[src]
pub fn new(reader_id: ReaderId<ComponentEvent>) -> Self where
P: Component,
P::Storage: Tracked,
[src]
P: Component,
P::Storage: Tracked,
Create a new hierarchy object.
pub fn all(&self) -> &[Entity]
[src]
Get all entities that contain parents, in sorted order, where parents are guaranteed to be before their children.
Note: This does not include entities that are parents.
pub fn children(&self, entity: Entity) -> &[Entity]
[src]
Get the immediate children of a specific entity.
pub fn all_children(&self, entity: Entity) -> BitSet
[src]
Get all children of this entity recursively as a BitSet
This does not include the parent entity you pass in.
ⓘImportant traits for SubHierarchyIterator<'a, P>pub fn all_children_iter<'a>(
&'a self,
entity: Entity
) -> SubHierarchyIterator<'a, P>
[src]
&'a self,
entity: Entity
) -> SubHierarchyIterator<'a, P>
Returns an iterator over all of the recursive children of this entity.
This does not include the parent entity you pass in. Parents are guaranteed to be prior to their children.
pub fn parent(&self, entity: Entity) -> Option<Entity>
[src]
Get the parent of a specific entity
pub fn track(&mut self) -> ReaderId<HierarchyEvent>
[src]
Get a token for tracking the modification events from the hierarchy
pub fn changed(&self) -> &EventChannel<HierarchyEvent>
[src]
Get the EventChannel
for the modification events for reading
pub fn maintain(&mut self, data: ParentData<P>) where
P: Component + Parent,
P::Storage: Tracked,
[src]
P: Component + Parent,
P::Storage: Tracked,
Maintain the hierarchy, usually only called by HierarchySystem
.
Trait Implementations
impl<P> SetupHandler<Hierarchy<P>> for HierarchySetupHandler<P> where
P: Component + Send + Sync + 'static,
P::Storage: Tracked,
[src]
P: Component + Send + Sync + 'static,
P::Storage: Tracked,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: Any,
T: Any,
fn get_type_id(&self) -> TypeId
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,