dtAnim::AnimationHelper Class Reference

The AnimationHelper class is a utility class to simplify adding animation to an articulated entity, it provides support for loading, rendering and animating. More...

#include <animationhelper.h>

List of all members.

Public Member Functions

 AnimationHelper ()
 The constructor constructs a default AnimNodeBuilder, the Cal3DModelWrapper, and AnimationController are created on LoadModel().
virtual void Update (float dt)
 The user should call Update() on a per frame basis this function updates the sequence mixer and the Cal3DAnimator.
bool LoadModel (const std::string &pFilename)
 This function loads a character XML file from string, on loading it creates a Cal3DAnimator with the Cal3DModelWrapper and then calls CreateGeode() on the AnimNodeBuilder.
void PlayAnimation (const std::string &pAnim)
 This function plays the specified animation defined within the character XML.
void ClearAnimation (const std::string &pAnim, float fadeOutTime)
 This function stops playing an animation by name over the course of time specified by fade out.
void ClearAll (float fadeOutTime)
 This function stops playing all currently active animations over the time specified by fade out.
osg::Node * GetNode ()
 
Returns:
the osg::Geode() created by the builder on LoadModel

const osg::Node * GetNode () const
 
Returns:
the osg::Geode() created by the builder on LoadModel

Cal3DAnimatorGetAnimator ()
 
Returns:
The Cal3DAnimator created on LoadModel

const Cal3DAnimatorGetAnimator () const
 
Returns:
The Cal3DAnimator created on LoadModel

Cal3DModelWrapperGetModelWrapper ()
 
Returns:
The Cal3DModelWrapper held by the animator

const Cal3DModelWrapperGetModelWrapper () const
 
Returns:
The Cal3DModelWrapper held by the animator

SequenceMixerGetSequenceMixer ()
 
Returns:
The SequenceMixer used to play, clear, and register new animations

const SequenceMixerGetSequenceMixer () const
 
Returns:
The SequenceMixer used to play, clear, and register new animations

virtual void GetActorProperties (dtDAL::ActorProxy &pProxy, std::vector< dtCore::RefPtr< dtDAL::ActorProperty > > &pFillVector)
 This function is used to create the proper actor properties for an animated entity after calling this function the user must iterate through the vector and add each property to its proxy.
bool GetGroundClamp () const
 This flag is used by the AnimationComponent to determine if this entity should be ground clamped.
void SetGroundClamp (bool b)
 Set whether or not this entity should be ground clamped.
AttachmentControllerGetAttachmentController ()
 The animation helper has an attachment controller that moves the Transformable attachments to match up to the bones.
void SetAttachmentController (AttachmentController &newController)
 Assigns a new AttachmentController.

Static Public Attributes

static const std::string PROPERTY_SKELETAL_MESH

Protected Member Functions

virtual ~AnimationHelper ()


Detailed Description

The AnimationHelper class is a utility class to simplify adding animation to an articulated entity, it provides support for loading, rendering and animating.

The constructor takes an AnimNodeBuilder which will create an osg::Geode given a Cal3DModelWrapper. The builder will be used to create the geode on LoadModel(), after that call GetGeode() and add this as a child of your actor's osg::Node


Constructor & Destructor Documentation

dtAnim::AnimationHelper::AnimationHelper (  ) 

The constructor constructs a default AnimNodeBuilder, the Cal3DModelWrapper, and AnimationController are created on LoadModel().

dtAnim::AnimationHelper::~AnimationHelper (  )  [protected, virtual]


Member Function Documentation

void dtAnim::AnimationHelper::Update ( float  dt  )  [virtual]

The user should call Update() on a per frame basis this function updates the sequence mixer and the Cal3DAnimator.

bool dtAnim::AnimationHelper::LoadModel ( const std::string &  pFilename  ) 

This function loads a character XML file from string, on loading it creates a Cal3DAnimator with the Cal3DModelWrapper and then calls CreateGeode() on the AnimNodeBuilder.

Parameters:
the name of the file to load
Returns:
whether or not we successfully loaded the file

void dtAnim::AnimationHelper::PlayAnimation ( const std::string &  pAnim  ) 

This function plays the specified animation defined within the character XML.

Parameters:
The name of the animation to play

void dtAnim::AnimationHelper::ClearAnimation ( const std::string &  pAnim,
float  fadeOutTime 
)

This function stops playing an animation by name over the course of time specified by fade out.

Parameters:
The name of the animation to clear
The amount of time to fade out over

void dtAnim::AnimationHelper::ClearAll ( float  fadeOutTime  ) 

This function stops playing all currently active animations over the time specified by fade out.

Parameters:
The amount of time to fade out over

osg::Node * dtAnim::AnimationHelper::GetNode (  ) 

Returns:
the osg::Geode() created by the builder on LoadModel

const osg::Node * dtAnim::AnimationHelper::GetNode (  )  const

Returns:
the osg::Geode() created by the builder on LoadModel

Cal3DAnimator * dtAnim::AnimationHelper::GetAnimator (  ) 

Returns:
The Cal3DAnimator created on LoadModel

const Cal3DAnimator * dtAnim::AnimationHelper::GetAnimator (  )  const

Returns:
The Cal3DAnimator created on LoadModel

Cal3DModelWrapper * dtAnim::AnimationHelper::GetModelWrapper (  ) 

Returns:
The Cal3DModelWrapper held by the animator

const Cal3DModelWrapper * dtAnim::AnimationHelper::GetModelWrapper (  )  const

Returns:
The Cal3DModelWrapper held by the animator

SequenceMixer & dtAnim::AnimationHelper::GetSequenceMixer (  ) 

Returns:
The SequenceMixer used to play, clear, and register new animations

const SequenceMixer & dtAnim::AnimationHelper::GetSequenceMixer (  )  const

Returns:
The SequenceMixer used to play, clear, and register new animations

void dtAnim::AnimationHelper::GetActorProperties ( dtDAL::ActorProxy pProxy,
std::vector< dtCore::RefPtr< dtDAL::ActorProperty > > &  pFillVector 
) [virtual]

This function is used to create the proper actor properties for an animated entity after calling this function the user must iterate through the vector and add each property to its proxy.

Parameters:
the actor proxy
an empty vector to fill of actor properties

bool dtAnim::AnimationHelper::GetGroundClamp (  )  const

This flag is used by the AnimationComponent to determine if this entity should be ground clamped.

void dtAnim::AnimationHelper::SetGroundClamp ( bool  b  ) 

Set whether or not this entity should be ground clamped.

AttachmentController & dtAnim::AnimationHelper::GetAttachmentController (  ) 

The animation helper has an attachment controller that moves the Transformable attachments to match up to the bones.

Returns:
the currently assigned attachment controller.

void dtAnim::AnimationHelper::SetAttachmentController ( AttachmentController newController  ) 

Assigns a new AttachmentController.

One is created by default, so this is provided to allow a developer to subclass the controller and assign the new one to the helper.


Member Data Documentation

const std::string dtAnim::AnimationHelper::PROPERTY_SKELETAL_MESH [static]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008