Urho3D
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Dviglo::AnimationState Class Reference

Animation instance. More...

#include </home/runner/work/Dviglo/Dviglo/DvigloRepository/Source/Urho3D/Graphics/AnimationState.h>

Inheritance diagram for Dviglo::AnimationState:
Dviglo::RefCounted

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.
 
 ~AnimationState () override
 Destruct.
 
void SetStartBone (Bone *startBone)
 
void SetLooped (bool looped)
 
void SetWeight (float weight)
 
void SetBlendMode (AnimationBlendMode mode)
 
void SetTime (float time)
 
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)
 
AnimationGetAnimation () const
 
AnimatedModelGetModel () const
 
NodeGetNode () const
 
BoneGetStartBone () const
 
float GetBoneWeight (unsigned index) const
 Return per-bone blending weight by track index.
 
float GetBoneWeight (const String &name) const
 
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
 
bool IsLooped () const
 
float GetWeight () const
 
AnimationBlendMode GetBlendMode () const
 
float GetTime () const
 
float GetLength () const
 
unsigned char GetLayer () const
 
void Apply ()
 Apply the animation at the current time position.
 
- Public Member Functions inherited from Dviglo::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.
 
void AddRef ()
 
void ReleaseRef ()
 
int Refs () const
 
int WeakRefs () const
 
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.

Member Function Documentation

◆ GetAnimation()

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

Return animation.

◆ GetBlendMode()

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

Return blending mode.

◆ GetBoneWeight()

float Dviglo::AnimationState::GetBoneWeight ( const String name) const

Return per-bone blending weight by name.

◆ GetLayer()

unsigned char Dviglo::AnimationState::GetLayer ( ) const
inline

Return blending layer.

◆ GetLength()

float Dviglo::AnimationState::GetLength ( ) const

Return animation length.

◆ GetModel()

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

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

◆ GetNode()

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

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

◆ GetStartBone()

Bone * Dviglo::AnimationState::GetStartBone ( ) const

Return start bone.

◆ GetTime()

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

Return time position.

◆ GetWeight()

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

Return blending weight.

◆ IsEnabled()

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

Return whether weight is nonzero.

◆ IsLooped()

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

Return whether looped.

◆ SetBlendMode()

void Dviglo::AnimationState::SetBlendMode ( AnimationBlendMode  mode)

Set blending mode.

◆ SetLayer()

void Dviglo::AnimationState::SetLayer ( unsigned char  layer)

Set blending layer.

◆ SetLooped()

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

Set looping enabled/disabled.

◆ SetStartBone()

void Dviglo::AnimationState::SetStartBone ( Bone startBone)

Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.

◆ SetTime()

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

Set time position. Does not fire animation triggers.

◆ SetWeight()

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

Set blending weight.


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