OGRE 14.3
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::AnimationState Class Reference

Represents the state of an animation and the weight of its influence. More...

#include <OgreAnimationState.h>

+ Inheritance diagram for Ogre::AnimationState:

Public Types

typedef std::vector< floatBoneBlendMask
 Typedef for an array of float values used as a bone blend mask.
 

Public Member Functions

 AnimationState (AnimationStateSet *parent, const AnimationState &rhs)
 Constructor to copy from an existing state with new parent.
 
 AnimationState (const String &animName, AnimationStateSet *parent, Real timePos, Real length, Real weight=1.0, bool enabled=false)
 Normal constructor with all params supplied.
 
void _setBlendMask (const BoneBlendMask *blendMask)
 Set the blend mask.
 
void addTime (Real offset)
 Modifies the time position, adjusting for animation length.
 
void copyStateFrom (const AnimationState &animState)
 Copies the states from another animation state, preserving the animation name (unlike operator=) but copying everything else.
 
void createBlendMask (size_t blendMaskSizeHint, float initialWeight=1.0f)
 Create a new blend mask with the given number of entries.
 
void destroyBlendMask ()
 Destroy the currently set blend mask.
 
const StringgetAnimationName () const
 Gets the name of the animation to which this state applies.
 
const BoneBlendMaskgetBlendMask () const
 Get the current blend mask.
 
float getBlendMaskEntry (size_t boneHandle) const
 Get the weight for the bone identified by the given handle.
 
bool getEnabled (void) const
 Returns true if this animation is currently enabled.
 
Real getLength () const
 Gets the total length of this animation (may be shorter than whole animation)
 
bool getLoop (void) const
 Gets whether or not this animation loops

 
AnimationStateSetgetParent (void) const
 Get the parent animation state set.
 
Real getTimePosition (void) const
 Gets the time position for this animation.
 
Real getWeight (void) const
 Gets the weight (influence) of this animation.
 
bool hasBlendMask () const
 Return whether there is currently a valid blend mask set.
 
bool hasEnded (void) const
 Returns true if the animation has reached the end and is not looping.
 
bool operator!= (const AnimationState &rhs) const
 Inequality operator.
 
bool operator== (const AnimationState &rhs) const
 Equality operator.
 
void setBlendMaskEntry (size_t boneHandle, float weight)
 Set the weight for the bone identified by the given handle.
 
void setEnabled (bool enabled)
 Sets whether this animation is enabled.
 
void setLength (Real len)
 Sets the total length of this animation (may be shorter than whole animation)
 
void setLoop (bool loop)
 Sets whether or not an animation loops at the start and end of the animation if the time continues to be altered.
 
void setTimePosition (Real timePos)
 Sets the time position for this animation.
 
void setWeight (Real weight)
 Sets the weight (influence) of this animation.
 

Detailed Description

Represents the state of an animation and the weight of its influence.

Other classes can hold instances of this class to store the state of any animations they are using.

Member Typedef Documentation

◆ BoneBlendMask

Typedef for an array of float values used as a bone blend mask.

Constructor & Destructor Documentation

◆ AnimationState() [1/2]

Ogre::AnimationState::AnimationState ( const String animName,
AnimationStateSet parent,
Real  timePos,
Real  length,
Real  weight = 1.0,
bool  enabled = false 
)

Normal constructor with all params supplied.

Parameters
animNameThe name of this state.
parentThe parent AnimationStateSet that this state will belong to.
timePosThe position, in seconds, where this state will begin.
lengthThe length, in seconds, of this animation state.
weightWeight to apply the animation state with.
enabledWhether the animation state is enabled.

◆ AnimationState() [2/2]

Ogre::AnimationState::AnimationState ( AnimationStateSet parent,
const AnimationState rhs 
)

Constructor to copy from an existing state with new parent.

Member Function Documentation

◆ getAnimationName()

const String & Ogre::AnimationState::getAnimationName ( ) const

Gets the name of the animation to which this state applies.

◆ getTimePosition()

Real Ogre::AnimationState::getTimePosition ( void  ) const

Gets the time position for this animation.

Referenced by Ogre::AnimationStateControllerValue::getValue().

◆ setTimePosition()

void Ogre::AnimationState::setTimePosition ( Real  timePos)

Sets the time position for this animation.

Referenced by Ogre::AnimationStateControllerValue::setValue().

◆ getLength()

Real Ogre::AnimationState::getLength ( ) const

Gets the total length of this animation (may be shorter than whole animation)

Referenced by Ogre::AnimationStateControllerValue::getValue(), and Ogre::AnimationStateControllerValue::setValue().

◆ setLength()

void Ogre::AnimationState::setLength ( Real  len)

Sets the total length of this animation (may be shorter than whole animation)

◆ getWeight()

Real Ogre::AnimationState::getWeight ( void  ) const

Gets the weight (influence) of this animation.

◆ setWeight()

void Ogre::AnimationState::setWeight ( Real  weight)

Sets the weight (influence) of this animation.

◆ addTime()

void Ogre::AnimationState::addTime ( Real  offset)

Modifies the time position, adjusting for animation length.

Parameters
offsetThe amount of time, in seconds, to extend the animation.

This method loops at the edges if animation looping is enabled.

Referenced by Ogre::AnimationStateControllerValue::setValue().

◆ hasEnded()

bool Ogre::AnimationState::hasEnded ( void  ) const

Returns true if the animation has reached the end and is not looping.

◆ getEnabled()

bool Ogre::AnimationState::getEnabled ( void  ) const

Returns true if this animation is currently enabled.

◆ setEnabled()

void Ogre::AnimationState::setEnabled ( bool  enabled)

Sets whether this animation is enabled.

◆ operator==()

bool Ogre::AnimationState::operator== ( const AnimationState rhs) const

Equality operator.

◆ operator!=()

bool Ogre::AnimationState::operator!= ( const AnimationState rhs) const

Inequality operator.

◆ setLoop()

void Ogre::AnimationState::setLoop ( bool  loop)
inline

Sets whether or not an animation loops at the start and end of the animation if the time continues to be altered.

◆ getLoop()

bool Ogre::AnimationState::getLoop ( void  ) const
inline

Gets whether or not this animation loops

◆ copyStateFrom()

void Ogre::AnimationState::copyStateFrom ( const AnimationState animState)

Copies the states from another animation state, preserving the animation name (unlike operator=) but copying everything else.

Parameters
animStateReference to animation state which will use as source.

◆ getParent()

AnimationStateSet * Ogre::AnimationState::getParent ( void  ) const
inline

Get the parent animation state set.

◆ createBlendMask()

void Ogre::AnimationState::createBlendMask ( size_t  blendMaskSizeHint,
float  initialWeight = 1.0f 
)

Create a new blend mask with the given number of entries.

In addition to assigning a single weight value to a skeletal animation, it may be desirable to assign animation weights per bone using a 'blend mask'.

Parameters
blendMaskSizeHintThe number of bones of the skeleton owning this AnimationState.
initialWeightThe value all the blend mask entries will be initialised with (negative to skip initialisation)

◆ destroyBlendMask()

void Ogre::AnimationState::destroyBlendMask ( )

Destroy the currently set blend mask.

◆ _setBlendMask()

void Ogre::AnimationState::_setBlendMask ( const BoneBlendMask blendMask)

Set the blend mask.

The size of the array should match the number of entries the
blend mask was created with.
Stick to the setBlendMaskEntry method if you don't know exactly what you're doing.

◆ getBlendMask()

const BoneBlendMask * Ogre::AnimationState::getBlendMask ( ) const
inline

Get the current blend mask.

◆ hasBlendMask()

bool Ogre::AnimationState::hasBlendMask ( ) const
inline

Return whether there is currently a valid blend mask set.

◆ setBlendMaskEntry()

void Ogre::AnimationState::setBlendMaskEntry ( size_t  boneHandle,
float  weight 
)

Set the weight for the bone identified by the given handle.

◆ getBlendMaskEntry()

float Ogre::AnimationState::getBlendMaskEntry ( size_t  boneHandle) const
inline

Get the weight for the bone identified by the given handle.


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