AnimationClip

Functions

CID

GetClassID

void *

As

const void *

As

class T_As

As

class T_As

As

AnimationClip

~AnimationClip

double

GetDuration

unsigned int

GetChannelsCount

RED_RC

GetKeysCount

RED_RC

GetKeyTime

RED_RC

GetKeyData

RED_RC

Interpolate

RED_RC

InterpolateChannel

RED_RC

CreateChannels

RED_RC

AddKey

Detailed Description

class AnimationClip : public RED::Object

Atomic class to store animation key frames.

@related class RED::AnimationData, class RED::IAnimationClipController, Playing an Animation Clip

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.

Public Functions

virtual void *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.

virtual const void *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.

template<class T_As>
inline T_As *As()
template<class T_As>
inline const T_As *As() const
AnimationClip()

Constructor.

~AnimationClip()

Destructor.

inline double GetDuration() const

Gets the animation clip duration.

Returns

the clip duration.

inline unsigned int GetChannelsCount() const

Gets the number of channels in the animation clip.

Returns

the number of animation channels.

RED_RC GetKeysCount(unsigned int &oKeysCount, unsigned int iChannel = 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.

RED_RC GetKeyTime(double &oTime, unsigned int iKey, unsigned int iChannel = 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.

RED_RC GetKeyData(const RED::AnimationData *&oData, unsigned int iKey, unsigned int iChannel = 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.

RED_RC Interpolate(RED::Vector<RED::AnimationData> &oOutput, double iTime) const

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.

RED_RC InterpolateChannel(RED::AnimationData &oOutput, unsigned int iChannel, double iTime) 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.

RED_RC CreateChannels(unsigned int iChannelsCount)

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.

RED_RC AddKey(const RED::AnimationData &iKeyData, double iTime, unsigned int iChannel = 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 Static Functions

static inline RED::CID GetClassID()