V-ART
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
VART::Action Class Reference

A coordinated movement of joints in an articulated body. More...

#include <action.h>

Inheritance diagram for VART::Action:
VART::XmlAction

Public Member Functions

 Action ()
 Creates an unitialized action. More...
 
 ~Action ()
 
VART::Actionoperator= (const VART::Action &action)
 Copy action data, except the active atribute (that remains unmodified). Used in Action::Copy() method. More...
 
JointMoverAddJointMover (Joint *jointPtr, float newDuration, const Interpolator &interpolator)
 Adds a joint mover to the action. More...
 
JointMoverAddJointMover (Joint *jointPtr, JointMover *jointMover)
 Used to add a copy of jointMover, aplied to jointPtr. More...
 
void SetPriority (unsigned int newPriority)
 Sets the priority of an action. More...
 
void SetSpeed (float newSpeed)
 Sets the speed of an action. More...
 
void SetCyclic (bool value)
 Sets whether an action is cyclic. More...
 
bool IsCyclic ()
 Checks whether the action is cyclic. More...
 
void Set (float newSpeed, unsigned int newPriority, bool cyclic)
 Sets speed, priority and cycle attibutes. More...
 
void Activate ()
 Activate action. More...
 
void Deactivate ()
 Deactivate action. More...
 
void Deactivate (float seconds)
 Deactivate action after some time. More...
 
bool IsActive () const
 Returns true if the action is currently active. More...
 
void GetFinalTimes (std::list< float > *resultPtr)
 Returns a ordered list with all different final times for every dof mover. More...
 
VART::ActionCopy (VART::SceneNode &targetNode)
 Returns a copy of an action, aplied to an targetNode sceneNode. More...
 
void ModifyDofMovers (DMModifier &mod)
 Modifies dof movers. More...
 

Static Public Member Functions

static unsigned int MoveAllActive ()
 Moves all active actions. More...
 

Public Attributes

std::string description
 Textual description. More...
 
CallBackcallbackPtr
 A call-back to be activated once the action is finished/deactivated. More...
 

Static Public Attributes

static float frameFrequency = 0.0f
 Fake animation time. More...
 

Protected Member Functions

void Move ()
 Animate joints. More...
 
void DeactivateDofMovers ()
 Deactivates DOF movers in every joint mover. More...
 

Protected Attributes

bool cycle
 
bool active
 
float speed
 
float duration
 
float timeToLive
 
unsigned int priority
 seconds to auto deactivation More...
 
std::list< JointMover * > jointMoverList
 
Time initialTime
 

Static Protected Attributes

static std::list< Action * > activeInstances
 

Friends

std::ostream & operator<< (std::ostream &output, const Action &action)
 

Detailed Description

A coordinated movement of joints in an articulated body.

Deprecated:
Please use JointAction.

Actions represent simple tasks such as walking, waving or scratching the head. They may be thought as an integration of key poses, interpolation schemes and time control. When the time period for a non-cyclic action terminates, it is automatically deactivated. They are implementated as a collection of joint movers (see JointMover).

Definition at line 29 of file action.h.

Constructor & Destructor Documentation

VART::Action::Action ( )

Creates an unitialized action.

Definition at line 19 of file action.cpp.

VART::Action::~Action ( )

Definition at line 37 of file action.cpp.

Member Function Documentation

void VART::Action::Activate ( )

Activate action.

Definition at line 127 of file action.cpp.

VART::JointMover * VART::Action::AddJointMover ( VART::Joint jointPtr,
float  newDuration,
const Interpolator interpolator 
)

Adds a joint mover to the action.

Returns
A pointer to a newly created joint mover.
Parameters
[in]jointPtrA pointer to the joint that will be controlled by the new joint mover.
[in]newDurationDuration (in seconds) of the joint movement.
[in]interpolatorAn interpolator instance that will control motion.
Attention
Make sure that "interpolator" remains in its original memory space during lifetime of the joint mover. The joint mover will keep just a pointer to the interpolator.

Creates a new joint mover which is assigned to the action. The memory allocated by the joint mover will be deallocated by the action's destructor.

Definition at line 52 of file action.cpp.

Referenced by Copy().

VART::JointMover * VART::Action::AddJointMover ( Joint jointPtr,
JointMover jointMover 
)

Used to add a copy of jointMover, aplied to jointPtr.

Definition at line 62 of file action.cpp.

References VART::JointMover::CopyFrom(), VART::JointMover::GetDuration(), and VART::JointMover::GetInterpolator().

VART::Action * VART::Action::Copy ( VART::SceneNode targetNode)

Returns a copy of an action, aplied to an targetNode sceneNode.

Use it when copy actions and aply it to a copy of sceneNodes (using SceneNode::RecursiveCopy() method).

Definition at line 224 of file action.cpp.

References AddJointMover(), VART::SceneNode::FindChildByName(), and jointMoverList.

void VART::Action::Deactivate ( )

Deactivate action.

Definition at line 156 of file action.cpp.

void VART::Action::Deactivate ( float  seconds)

Deactivate action after some time.

Definition at line 183 of file action.cpp.

void VART::Action::DeactivateDofMovers ( )
protected

Deactivates DOF movers in every joint mover.

Deactivation of a DOF mover means it will have to recompute its motion at next move. See DofMover::Move().

Definition at line 188 of file action.cpp.

void VART::Action::GetFinalTimes ( std::list< float > *  resultPtr)

Returns a ordered list with all different final times for every dof mover.

Definition at line 215 of file action.cpp.

bool VART::Action::IsActive ( ) const
inline

Returns true if the action is currently active.

Definition at line 85 of file action.h.

References active.

bool VART::Action::IsCyclic ( )
inline

Checks whether the action is cyclic.

Definition at line 70 of file action.h.

References cycle.

void VART::Action::ModifyDofMovers ( DMModifier mod)

Modifies dof movers.

Definition at line 246 of file action.cpp.

void VART::Action::Move ( )
protected

Animate joints.

Definition at line 70 of file action.cpp.

References VART::DofMover::cycle, VART::JointMover::goalTime, VART::DofMover::priority, and VART::Time::Set().

unsigned int VART::Action::MoveAllActive ( )
static

Moves all active actions.

Returns
The number of active actions.

Definition at line 195 of file action.cpp.

References VART::Dof::ClearPriorities().

VART::Action & VART::Action::operator= ( const VART::Action action)

Copy action data, except the active atribute (that remains unmodified). Used in Action::Copy() method.

Definition at line 24 of file action.cpp.

References cycle, description, duration, initialTime, priority, speed, and timeToLive.

void VART::Action::Set ( float  newSpeed,
unsigned int  newPriority,
bool  cyclic 
)

Sets speed, priority and cycle attibutes.

Definition at line 45 of file action.cpp.

void VART::Action::SetCyclic ( bool  value)
inline

Sets whether an action is cyclic.

Definition at line 67 of file action.h.

References cycle.

void VART::Action::SetPriority ( unsigned int  newPriority)
inline

Sets the priority of an action.

Definition at line 61 of file action.h.

References priority.

void VART::Action::SetSpeed ( float  newSpeed)
inline

Sets the speed of an action.

Definition at line 64 of file action.h.

References speed.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const Action action 
)
friend

Member Data Documentation

bool VART::Action::active
protected

Definition at line 125 of file action.h.

Referenced by IsActive().

list< VART::Action * > VART::Action::activeInstances
staticprotected

Definition at line 135 of file action.h.

CallBack* VART::Action::callbackPtr

A call-back to be activated once the action is finished/deactivated.

Definition at line 113 of file action.h.

bool VART::Action::cycle
protected

Definition at line 124 of file action.h.

Referenced by IsCyclic(), operator=(), and SetCyclic().

std::string VART::Action::description

Textual description.

Definition at line 111 of file action.h.

Referenced by operator=().

float VART::Action::duration
protected

Definition at line 129 of file action.h.

Referenced by operator=().

float VART::Action::frameFrequency = 0.0f
static

Fake animation time.

If greater then zero, the action does not measure real elapsed time from previous update. Instead it uses this value as elapsed time. Use it for creation of offline animations.

Definition at line 108 of file action.h.

Time VART::Action::initialTime
protected

Definition at line 133 of file action.h.

Referenced by operator=().

std::list<JointMover*> VART::Action::jointMoverList
protected

Definition at line 132 of file action.h.

Referenced by Copy().

unsigned int VART::Action::priority
protected

seconds to auto deactivation

Definition at line 131 of file action.h.

Referenced by operator=(), and SetPriority().

float VART::Action::speed
protected

Definition at line 128 of file action.h.

Referenced by operator=(), and SetSpeed().

float VART::Action::timeToLive
protected

Definition at line 130 of file action.h.

Referenced by operator=().


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