Animation instance. More...

#include <Urho3D/Graphics/AnimationState.h>

Inheritance diagram for Urho3D::AnimationState:
[legend]
Collaboration diagram for Urho3D::AnimationState:
[legend]

Public Member Functions

 AnimationState (AnimatedModel *model, Animation *animation)
 Construct with animated model and animation pointers.
 
 AnimationState (Node *node, Animation *animation)
 Construct with root scene node and animation pointers.
 
virtual ~AnimationState () override
 Destruct.
 
void SetStartBone (Bone *bone)
 Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.
 
void SetLooped (bool looped)
 Set looping enabled/disabled.
 
void SetWeight (float weight)
 Set blending weight.
 
void SetBlendMode (AnimationBlendMode mode)
 Set blending mode.
 
void SetTime (float time)
 Set time position. Does not fire animation triggers.
 
void SetBoneWeight (unsigned index, float weight, bool recursive=false)
 Set per-bone blending weight by track index. Default is 1.0 (full), is multiplied with the state's blending weight when applying the animation. Optionally recurses to child bones.
 
void SetBoneWeight (const String &name, float weight, bool recursive=false)
 Set per-bone blending weight by name.
 
void SetBoneWeight (StringHash nameHash, float weight, bool recursive=false)
 Set per-bone blending weight by name hash.
 
void AddWeight (float delta)
 Modify blending weight.
 
void AddTime (float delta)
 Modify time position. Animation triggers will be fired.
 
void SetLayer (unsigned char layer)
 Set blending layer.
 
AnimationGetAnimation () const
 Return animation.
 
AnimatedModelGetModel () const
 Return animated model this state belongs to (model mode.)
 
NodeGetNode () const
 Return root scene node this state controls (node hierarchy mode.)
 
BoneGetStartBone () const
 Return start bone.
 
float GetBoneWeight (unsigned index) const
 Return per-bone blending weight by track index.
 
float GetBoneWeight (const String &name) const
 Return per-bone blending weight by name.
 
float GetBoneWeight (StringHash nameHash) const
 Return per-bone blending weight by name.
 
unsigned GetTrackIndex (Node *node) const
 Return track index with matching bone node, or M_MAX_UNSIGNED if not found.
 
unsigned GetTrackIndex (const String &name) const
 Return track index by bone name, or M_MAX_UNSIGNED if not found.
 
unsigned GetTrackIndex (StringHash nameHash) const
 Return track index by bone name hash, or M_MAX_UNSIGNED if not found.
 
bool IsEnabled () const
 Return whether weight is nonzero.
 
bool IsLooped () const
 Return whether looped.
 
float GetWeight () const
 Return blending weight.
 
AnimationBlendMode GetBlendMode () const
 Return blending mode.
 
float GetTime () const
 Return time position.
 
float GetLength () const
 Return animation length.
 
unsigned char GetLayer () const
 Return blending layer.
 
void Apply ()
 Apply the animation at the current time position.
 
- 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.
 
void AddRef ()
 Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
 
void ReleaseRef ()
 Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
 
int Refs () const
 Return reference count.
 
int WeakRefs () const
 Return weak reference count.
 
RefCountRefCountPtr ()
 Return pointer to the reference count structure.
 

Private Member Functions

void ApplyToModel ()
 Apply animation to a skeleton. Transform changes are applied silently, so the model needs to dirty its root model afterward.
 
void ApplyToNodes ()
 Apply animation to a scene node hierarchy.
 
void ApplyTrack (AnimationStateTrack &stateTrack, float weight, bool silent)
 Apply track.
 

Private Attributes

WeakPtr< AnimatedModelmodel_
 Animated model (model mode.)
 
WeakPtr< Nodenode_
 Root scene node (node hierarchy mode.)
 
SharedPtr< Animationanimation_
 Animation.
 
BonestartBone_
 Start bone.
 
Vector< AnimationStateTrackstateTracks_
 Per-track data.
 
bool looped_
 Looped flag.
 
float weight_
 Blending weight.
 
float time_
 Time position.
 
unsigned char layer_
 Blending layer.
 
AnimationBlendMode blendingMode_
 Blending mode.
 

Detailed Description

Animation instance.


The documentation for this class was generated from the following files:
  • Source/Urho3D/Graphics/AnimationState.h
  • Source/Urho3D/Graphics/AnimationState.cpp