Rebel Fork Framework
Urho3D::AnimationState Class Reference

Animation instance. More...

#include <Urho3D/Graphics/AnimationState.h>

Inheritance diagram for Urho3D::AnimationState:
Urho3D::RefCounted

Public Member Functions

 AnimationState (AnimationController *controller, AnimatedModel *model)
 Construct with animated model and animation pointers.
 
 AnimationState (AnimationController *controller, Node *node)
 Construct with root scene node and animation pointers.
 
 ~AnimationState () override
 Destruct.
 
void Initialize (Animation *animation, const ea::string &startBone, AnimationBlendMode blendMode)
 Initialize static properties of the state and dirty tracks if changed.
 
void Update (bool looped, float time, float weight)
 Update dynamic properies of the state.
 
void SetLooped (bool looped)
 
void SetWeight (float weight)
 
void SetTime (float time)
 
AnimationGetAnimation () const
 
AnimatedModelGetModel () const
 
Node * GetNode () const
 
const ea::string & GetStartBone () const
 Return name of start bone.
 
bool IsEnabled () const
 
bool IsLooped () const
 
float GetWeight () const
 
AnimationBlendMode GetBlendMode () const
 
float GetTime () const
 
float GetLength () const
 
void CalculateModelTracks (ea::vector< ModelAnimationOutput > &output) const
 Calculate animation for the model skeleton.
 
void CalculateNodeTracks (ea::unordered_map< Node *, NodeAnimationOutput > &output) const
 Apply animation to a scene node hierarchy.
 
void CalculateAttributeTracks (ea::unordered_map< AnimatedAttributeReference, Variant > &output) const
 Apply animation to attributes.
 
bool AreTracksDirty () const
 
void MarkTracksDirty ()
 
void ClearAllTracks ()
 
void AddModelTrack (const ModelAnimationStateTrack &track)
 
void AddNodeTrack (const NodeAnimationStateTrack &track)
 
void AddAttributeTrack (const AttributeAnimationStateTrack &track)
 
void OnTracksReady ()
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
 
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
 
int AddRef ()
 
int ReleaseRef ()
 
int Refs () const
 
int WeakRefs () const
 
RefCountRefCountPtr () const
 Return pointer to the reference count structure.
 
bool HasScriptObject () const
 Return true if script runtime object wrapping this native object exists.
 
bool IsScriptStrongRef () const
 Return true if script reference is strong.
 

Private Member Functions

void CalculateTransformTrack (NodeAnimationOutput &output, const AnimationTrack &track, unsigned &frame, float baseWeight) const
 Apply value of transformation track to the output.
 
void CalculateAttributeTrack (Variant &output, const VariantAnimationTrack &track, unsigned &frame, float baseWeight) const
 Apply single attribute track to target object. Key frame hint is updated on call.
 

Private Attributes

WeakPtr< AnimationControllercontroller_
 Owner controller.
 
WeakPtr< AnimatedModelmodel_
 Animated model (model mode).
 
WeakPtr< Node > node_
 Root scene node (node hierarchy mode).
 
SharedPtr< Animationanimation_
 Animation.
 
bool tracksDirty_ { true }
 Whether the animation state tracks are dirty and should be updated.
 
unsigned animationRevision_ {}
 Revision of Animation object. Used to detect changes in animation.
 
bool looped_ {}
 
float weight_ {}
 
float time_ {}
 
AnimationBlendMode blendingMode_ {}
 
ea::string startBone_
 
ea::vector< ModelAnimationStateTrackmodelTracks_
 
ea::vector< NodeAnimationStateTracknodeTracks_
 
ea::vector< AttributeAnimationStateTrackattributeTracks_
 

Detailed Description

Animation instance.

Member Function Documentation

◆ AreTracksDirty()

bool Urho3D::AnimationState::AreTracksDirty ( ) const

Modify tracks. For internal use only.

◆ GetAnimation()

Animation* Urho3D::AnimationState::GetAnimation ( ) const
inline

Return animation.

◆ GetBlendMode()

AnimationBlendMode Urho3D::AnimationState::GetBlendMode ( ) const
inline

Return blending mode.

◆ GetLength()

float Urho3D::AnimationState::GetLength ( ) const

Return animation length.

◆ GetModel()

AnimatedModel * Urho3D::AnimationState::GetModel ( ) const

Return animated model this state belongs to (model mode).

◆ GetNode()

Node * Urho3D::AnimationState::GetNode ( ) const

Return root scene node this state controls (node hierarchy mode).

◆ GetTime()

float Urho3D::AnimationState::GetTime ( ) const
inline

Return time position.

◆ GetWeight()

float Urho3D::AnimationState::GetWeight ( ) const
inline

Return blending weight.

◆ IsEnabled()

bool Urho3D::AnimationState::IsEnabled ( ) const
inline

Return whether weight is nonzero.

◆ IsLooped()

bool Urho3D::AnimationState::IsLooped ( ) const
inline

Return whether looped.

◆ SetLooped()

void Urho3D::AnimationState::SetLooped ( bool  looped)

Set looping enabled/disabled.

◆ SetTime()

void Urho3D::AnimationState::SetTime ( float  time)

Set time position. Does not fire animation triggers.

◆ SetWeight()

void Urho3D::AnimationState::SetWeight ( float  weight)

Set blending weight.

Member Data Documentation

◆ looped_

bool Urho3D::AnimationState::looped_ {}
private

Dynamic properties of AnimationState.

◆ modelTracks_

ea::vector<ModelAnimationStateTrack> Urho3D::AnimationState::modelTracks_
private

Tracks that are actually applied to the objects.


The documentation for this class was generated from the following files: