Byte Engine Docs
View on docs.rs

system

Generated Rust API reference for byte_engine.

byte_engine / animation / system


Module system

The animation system an application steps on its world scope: it plays every animator's graph and posts each one's pose and root motion, as the animation reference's Animators section specifies.

Quick Reference

ItemKindDescription
AnimatorstructThe Animator struct is the request to play one graph on one entity, created through the world under the handle of the entity it poses, usually a skinned renderable.
AnimationGraphIdstructThe AnimationGraphId struct names a graph an [AnimationSystem] owns, so animators and the application refer to it without holding it.
RootMotionUpdatestructThe RootMotionUpdate struct carries the root motion a step extracted for one animator, for the code that owns the entity to move it by.
AnimationSystemstructThe AnimationSystem struct plays the animators of a world scope: each step it adopts new ones, applies the latest request and look target sent to each, advances them together, and posts every pose and root motion.

Structs

Animator

struct Animator {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/animation/system.rs:34-38

The Animator struct is the request to play one graph on one entity, created through the world under the handle of the entity it poses, usually a skinned renderable.

Build it with Self::new and the ID AnimationSystem::register returned for its graph, then create it with the entity, as in world.create(mesh).with(Animator::new(graph)). Next, send the states to play with world.set(request).on(handle) and read the root motion the system posts.

Implementations

  • fn new(graph: AnimationGraphId) -> Self

    Related: AnimationGraphId

    Plays the graph the system registered under graph.

  • const fn with_root_motion(self, settings: RootMotionSettings<'static>) -> Self

    Related: RootMotionSettings

    Extracts root motion from the pose as settings say; see RootMotionSettings.

  • const fn with_look_chain(self, settings: LookChainSettings<'static>) -> Self

    Related: LookChainSettings

    Turns a chain of nodes toward the look targets sent to the entity; see LookChainSettings.

Trait Implementations

impl ArchivePointee for Animator
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Animator
impl Clone for Animator
  • fn clone(&self) -> Animator

    Related: Animator

impl Copy for Animator
impl Debug for Animator
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for Animator
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for Animator
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for Animator
impl LayoutRaw for Animator
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Animator
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for Animator
  • fn eq(&self, other: &Animator) -> bool

    Related: Animator

impl Pointee for Animator
  • type Metadata = ()
impl Read for Animator
impl StructuralPartialEq for Animator
impl WithSubscriber for Animator

AnimationGraphId

struct AnimationGraphId();

Defined in crates/byte-engine/src/animation/system.rs:68

The AnimationGraphId struct names a graph an AnimationSystem owns, so animators and the application refer to it without holding it.

Get one from AnimationSystem::register, then pass it to Animator::new.

Trait Implementations

impl ArchivePointee for AnimationGraphId
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for AnimationGraphId
impl Clone for AnimationGraphId
impl Copy for AnimationGraphId
impl Debug for AnimationGraphId
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for AnimationGraphId
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for AnimationGraphId
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Eq for AnimationGraphId
impl<K> Equivalent for AnimationGraphId
  • fn equivalent(&self, key: &K) -> bool
impl Hash for AnimationGraphId
  • fn hash<__H: hash::Hasher>(&self, state: &mut __H)
impl Instrument for AnimationGraphId
impl LayoutRaw for AnimationGraphId
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for AnimationGraphId
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for AnimationGraphId
impl Pointee for AnimationGraphId
  • type Metadata = ()
impl Read for AnimationGraphId
impl StructuralPartialEq for AnimationGraphId
impl WithSubscriber for AnimationGraphId

RootMotionUpdate

struct RootMotionUpdate {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/animation/system.rs:76-81

The RootMotionUpdate struct carries the root motion a step extracted for one animator, for the code that owns the entity to move it by. The system never moves an entity itself.

Listen on the scope's channel::<RootMotionUpdate>() and read the updates right after AnimationSystem::step, so the transform you write matches the pose that frame draws.

Implementations

  • const fn handle(&self) -> Handle

    Returns the entity the animator poses.

  • const fn delta(&self) -> RootMotionDelta

    Related: RootMotionDelta

    Returns the step's root motion delta, in the entity's object space; the identity for an animator without root

    motion settings.

  • const fn state(&self) -> Option<AnimationStateId>

    Related: AnimationStateId

    Returns the state playing after the step, so a route taken this step, like a turn clip handing over, can be

    acted on with the pose it produced.

  • const fn waiting_for(&self) -> Option<AnimationStateId>

    Related: AnimationStateId

    Returns the requested state whose route waits for a moment of the playing clip, such as a frame, or None

    when no route waits.

Trait Implementations

impl ArchivePointee for RootMotionUpdate
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for RootMotionUpdate
impl Clone for RootMotionUpdate
impl Copy for RootMotionUpdate
impl Debug for RootMotionUpdate
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for RootMotionUpdate
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for RootMotionUpdate
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for RootMotionUpdate
impl LayoutRaw for RootMotionUpdate
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for RootMotionUpdate
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for RootMotionUpdate
impl Pointee for RootMotionUpdate
  • type Metadata = ()
impl Read for RootMotionUpdate
impl StructuralPartialEq for RootMotionUpdate
impl WithSubscriber for RootMotionUpdate

AnimationSystem

struct AnimationSystem {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/animation/system.rs:139-156

The AnimationSystem struct plays the animators of a world scope: each step it adopts new ones, applies the latest request and look target sent to each, advances them together, and posts every pose and root motion.

Create it with Self::new before the animators it must play and register their graphs, then call Self::step once per frame after your requests for that frame and before the systems that read transforms, such as Physics::step. Read what each animator plays, and the root motion to move it by, from the RootMotionUpdate each step posts.

Implementations

  • fn new(scope: &MessageScope, resources: crate::core::EntityHandle<resource_management::resource::resource_manager::ResourceManager>, parameters: impl crate::application::parameters::Parameters) -> (Self, crate::animation::graph::AnimationLoadWorker)

    Related: MessageScope, EntityHandle, AnimationLoadWorker

    Creates the system and its clip-loading worker before any animators are created in scope.

    Pass the application's animation parameter scope. pool-bytes sets the decoded clip budget in bytes

    and must be nonzero; it defaults to 32 MiB. Invalid values stop startup.

    Spawn the returned worker on the loading runtime, then register the graphs to play.

  • fn register(&mut self, graph: AnimationGraph) -> AnimationGraphId

    Related: AnimationGraph, AnimationGraphId

    Takes graph for the animators that name it, and returns its ID for Animator::new. Register a graph

    before creating its animators; an animator whose graph is unknown is reported and never plays.

    The system keeps the graph for as long as it lives, and its players share it, so nothing outside needs to.

  • fn step(&mut self, time: Time, alley: &mut Alley)

    Related: Time

    Advances every animator by the frame and posts its pose and root motion before returning.

    Deleted animators leave and created ones join first; then the latest request and look target sent to each

    apply; then the players advance together on alley's lanes. No other dispatch of alley may be running.

Trait Implementations

impl ArchivePointee for AnimationSystem
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for AnimationSystem
impl Downcast for AnimationSystem
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for AnimationSystem
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for AnimationSystem
impl LayoutRaw for AnimationSystem
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for AnimationSystem
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for AnimationSystem
  • type Metadata = ()
impl Read for AnimationSystem
impl WithSubscriber for AnimationSystem

On this page

Module systemQuick ReferenceStructsAnimatorImplementationsTrait Implementationsimpl ArchivePointee for Animatorimpl<ST> CastableFrom for Animatorimpl Clone for Animatorimpl Copy for Animatorimpl Debug for Animatorimpl Downcast for Animatorimpl DowncastSync for Animatorimpl Instrument for Animatorimpl LayoutRaw for Animatorimpl<T, N1> Niching for Animatorimpl PartialEq for Animatorimpl Pointee for Animatorimpl Read for Animatorimpl StructuralPartialEq for Animatorimpl WithSubscriber for AnimatorAnimationGraphIdTrait Implementationsimpl ArchivePointee for AnimationGraphIdimpl<ST> CastableFrom for AnimationGraphIdimpl Clone for AnimationGraphIdimpl Copy for AnimationGraphIdimpl Debug for AnimationGraphIdimpl Downcast for AnimationGraphIdimpl DowncastSync for AnimationGraphIdimpl Eq for AnimationGraphIdimpl<K> Equivalent for AnimationGraphIdimpl Hash for AnimationGraphIdimpl Instrument for AnimationGraphIdimpl LayoutRaw for AnimationGraphIdimpl<T, N1> Niching for AnimationGraphIdimpl PartialEq for AnimationGraphIdimpl Pointee for AnimationGraphIdimpl Read for AnimationGraphIdimpl StructuralPartialEq for AnimationGraphIdimpl WithSubscriber for AnimationGraphIdRootMotionUpdateImplementationsTrait Implementationsimpl ArchivePointee for RootMotionUpdateimpl<ST> CastableFrom for RootMotionUpdateimpl Clone for RootMotionUpdateimpl Copy for RootMotionUpdateimpl Debug for RootMotionUpdateimpl Downcast for RootMotionUpdateimpl DowncastSync for RootMotionUpdateimpl Instrument for RootMotionUpdateimpl LayoutRaw for RootMotionUpdateimpl<T, N1> Niching for RootMotionUpdateimpl PartialEq for RootMotionUpdateimpl Pointee for RootMotionUpdateimpl Read for RootMotionUpdateimpl StructuralPartialEq for RootMotionUpdateimpl WithSubscriber for RootMotionUpdateAnimationSystemImplementationsTrait Implementationsimpl ArchivePointee for AnimationSystemimpl<ST> CastableFrom for AnimationSystemimpl Downcast for AnimationSystemimpl DowncastSync for AnimationSystemimpl Instrument for AnimationSystemimpl LayoutRaw for AnimationSystemimpl<T, N1> Niching for AnimationSystemimpl Pointee for AnimationSystemimpl Read for AnimationSystemimpl WithSubscriber for AnimationSystem