class RED::AnimationClip

Atomic class to store animation key frames. More...

#include <REDAnimationClip.h>

Inherits: Object.

Public functions:

AnimationClip ( )
~AnimationClip ( )
RED_RCAddKey ( const RED::AnimationData & iKeyData, double iTime, unsigned int iChannel = 0 )
virtual void *As ( const RED::CID & iCID )
template< class T_As > const T_As *As ( ) const
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > T_As *As ( )
RED_RCCreateChannels ( unsigned int iChannelsCount )
unsigned intGetChannelsCount ( ) const
doubleGetDuration ( ) const
RED_RCGetKeyData ( const RED::AnimationData *& oData, unsigned int iKey, unsigned int iChannel = 0 ) const
RED_RCGetKeysCount ( unsigned int & oKeysCount, unsigned int iChannel = 0 ) const
RED_RCGetKeyTime ( double & oTime, unsigned int iKey, unsigned int iChannel = 0 ) const
RED_RCInterpolate ( RED::Vector< RED::AnimationData > & oOutput, double iTime ) const
RED_RCInterpolateChannel ( RED::AnimationData & oOutput, unsigned int iChannel, double iTime ) const

Public static functions:

static RED::CIDGetClassID ( )

Protected classes:

structAnimationChannel
structAnimationKey

Protected functions:

RED_RCGetSurroundingKeys ( const AnimationKey *& oKeyBefore, const AnimationKey *& oKeyAfter, unsigned int iChannel, double iTime ) const

Protected variables:

RED::Vector< AnimationChannel >_channels
double_duration

Detailed description:

Atomic class to store animation key frames.

An animation clip contains one or more animation channels.
Each animation channel stored the sequence of animation key frames.
A key frame is composed of an animation data (RED::AnimationData) associated with a timestamp in the channel.

The AnimationClip class also provides query methods to get the interpolated data at a given time in the animation clip.

Functions documentation

Constructor.

Destructor.

public RED_RC RED::AnimationClip::AddKey(const RED::AnimationData &iKeyData,
doubleiTime,
unsigned intiChannel = 0
)

Adds an animation key in a given channel at a given time.

Channels must have been created with RED::AnimationClip::CreateChannels before calling this function.

Note:

Important: keys must be added in the correct order from time 0 to end of animation in each channel. If not, the function will return RED_BAD_PARAM. The channel order is not important.

Parameters:

iKeyData:The animation key data to add.
iTime:Time of the animation key in the channel.
iChannel:Channel to add the key.

Returns:

RED_OK if the operation succeeded,
RED_BAD_PARAM if channel has not been created or if keys are not added in the correct order,
RED_FAIL otherwise.
public virtual void * RED::AnimationClip::As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public const T_As * RED::AnimationClip::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

public virtual const void * RED::AnimationClip::As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public T_As * RED::AnimationClip::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

public RED_RC RED::AnimationClip::CreateChannels(unsigned intiChannelsCount)

Creates one ore more animation channels in the clip.

Parameters:

iChannelsCount:Number of channels to create.

Returns:

RED_OK if the operation succeeded,
RED_FAIL otherwise.

Gets the number of channels in the animation clip.

Returns:

the number of animation channels.
public double RED::AnimationClip::GetDuration() const

Gets the animation clip duration.

Returns:

the clip duration.
public RED_RC RED::AnimationClip::GetKeyData(const RED::AnimationData *&oData,
unsigned intiKey,
unsigned intiChannel = 0
)const

Gets the data associated to a key in the animation channel.

Parameters:

oData:Returned key data.
iKey:Key index.
iChannel:Channel index.

Returns:

RED_OK if the operation succeeded,
RED_BAD_PARAM if the channel or key index is incorrect. RED_FAIL otherwise.
public RED_RC RED::AnimationClip::GetKeysCount(unsigned int &oKeysCount,
unsigned intiChannel = 0
)const

Gets the number of keys in the animation channel.

Parameters:

oKeysCount:Returned number of animation keys.
iChannel:Channel index.

Returns:

RED_OK if the operation succeeded,
RED_BAD_PARAM if the channel index is incorrect. RED_FAIL otherwise.
public RED_RC RED::AnimationClip::GetKeyTime(double &oTime,
unsigned intiKey,
unsigned intiChannel = 0
)const

Gets the time associated to a key in the animation channel.

Parameters:

oTime:Returned key time.
iKey:Key index.
iChannel:Channel index.

Returns:

RED_OK if the operation succeeded,
RED_BAD_PARAM if the channel or key index is incorrect. RED_FAIL otherwise.

Interpolates all the channels at a given time in the animation.

Parameters:

oOutput:Array to be filled with interpolation results.
iTime:Time at which the query is done.

Returns:

RED_OK if the operation succeeded,
RED_FAIL otherwise.
public RED_RC RED::AnimationClip::InterpolateChannel(RED::AnimationData &oOutput,
unsigned intiChannel,
doubleiTime
)const

Interpolates one channel at a given time in the animation.

Parameters:

oOutput:Returned interpolation result.
iChannel:Channel to interpolate.
iTime:Time at which the query is done.

Returns:

RED_OK if the operation succeeded,
RED_FAIL otherwise.
protected RED_RC RED::AnimationClip::GetSurroundingKeys(const AnimationKey *&oKeyBefore,
const AnimationKey *&oKeyAfter,
unsigned intiChannel,
doubleiTime
)const

Returns the animation keys before and after a given time in a given channel.

Parameters:

oKeyBefore:Returned animation key before iTime.
oKeyAfter:Returned animation key after iTime.
iChannel:Channel to get the keys.
iTime:Time to get the keys before and after.

Returns:

RED_OK if the operation succeeded,
RED_FAIL otherwise.

Variables documentation

_channels: list of animation channels in the clip.

_duration: total duration of the animation clip.