Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SkeletonT< PointT > Class Template Reference
Inheritance diagram for SkeletonT< PointT >:
Properties

Classes

class  AnimationIterator
 Iterator class for the animations attached to a skeleton. More...
 
class  Iterator
 Iterator class for the skeleton. More...
 

Public Types

typedef PointT Point
 
typedef Point::value_type Scalar
 
typedef JointT< Point > Joint
 
typedef PoseT< PointT > Pose
 
typedef AnimationT< PointT > Animation
 
typedef ACG::Matrix4x4T< Scalar > Matrix
 

Public Member Functions

 SkeletonT ()
 Default constructor. More...
 
 SkeletonT (const SkeletonT< PointT > &_other)
 Copy constructor. More...
 
SkeletonToperator= (const SkeletonT< PointT > &_other)
 Assignment operator. More...
 
 ~SkeletonT ()
 Destructor.
 
Modifying the tree structure

Use these methods to edit the skeleton tree.

void addJoint (typename SkeletonT< PointT >::Joint *_pParent, typename SkeletonT< PointT >::Joint *_pJoint)
 Adds a joint as child of a given parent joint. More...
 
void insertJoint (typename SkeletonT< PointT >::Joint *_pChild, typename SkeletonT< PointT >::Joint *_pInsert)
 insert a Joint given its future child joint More...
 
void removeJoint (typename SkeletonT< PointT >::Joint *_pJoint)
 Remove the given joint from the tree. More...
 
void clear ()
 Removes all joints from the skeleton. More...
 
Basic Joint Access

Use these methods to access joints in the skeleton.

Jointroot ()
 Returns the root joint. More...
 
Jointjoint (const unsigned int &_index)
 Returns the joint with the given index. More...
 
int parent (unsigned int _joint)
 Returns the parents id of the given node. More...
 
unsigned int childCount (unsigned int _joint)
 Returns the number of children of the given node.
 
unsigned int child (unsigned int _joint, unsigned int _child)
 Returns the child with the given index. More...
 
unsigned int jointCount ()
 Returns the number of joints.
 
Iterator begin ()
 Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs) More...
 
Iterator end ()
 Compare an iterator with the return value of this method to test if it is done.
 
Animation

Use these methods to equip the skeleton with animation data.

Posepose (const AnimationHandle &_hAni)
 Returns a pointer to the pose with the given animation handle. More...
 
PosereferencePose ()
 Returns a pointer to the reference pose. More...
 
AnimationHandle addAnimation (std::string _name, Animation *_animation)
 Adds a new animation to the list. More...
 
AnimationHandle cloneAnimation (std::string _name, const AnimationHandle &_hAni)
 Creates a new animation by cloning an existing one. More...
 
AnimationHandle animationHandle (std::string _name)
 Get an AnimationHandle to the animation with the given name.
 
Animationanimation (std::string _name)
 Returns a pointer to the animation to the given name.
 
Animationanimation (const AnimationHandle &_hAni)
 Returns a pointer to the animation to the given name.
 
void removeAnimation (std::string _name)
 Removes an animation from the list.
 
void removeAnimation (const AnimationHandle &_hAni)
 Removes an animation from the list.
 
void clearAnimations ()
 Removes all animations.
 
void replaceAnimationName (const std::string &_strOld, const std::string &_strNew)
 Returns a pointer to the pose with the given animation handle. More...
 
AnimationIterator animationsBegin ()
 Iterator over the animations. More...
 
AnimationIterator animationsEnd ()
 Returns an iterator pointing behind the last animation.
 
unsigned int animationCount ()
 Returns the number of animations stored in this skeleton. More...
 
const std::string & animationName (unsigned int _index)
 Returns the name of the animation with the given index. More...
 
- Public Member Functions inherited from Properties
template<typename T >
bool add_property (PropertyHandleT< T > &_hProp, std::string _name)
 Adds a new property. More...
 
template<typename T >
bool get_property (PropertyHandleT< T > &_hProp, std::string _name)
 Initiates the property handle. More...
 
bool has_property (std::string _name)
 Returns true if a property with the given name exists. More...
 
template<typename T >
bool remove_property (PropertyHandleT< T > &_hProp)
 Deletes a property including all values. More...
 
void clear_properties ()
 Deletes all properties, including their values. More...
 
template<typename T >
T & property (PropertyHandleT< T > &_hProp, int _index)
 Direct access to the properties values. More...
 

Protected Member Functions

void updateFromGlobal (unsigned int _idJoint)
 update the structure when parent changes for a joint More...
 
- Protected Member Functions inherited from Properties
void insert_property_at (int _index)
 Inserts a property for a new object at the given index. More...
 
void remove_property_at (int _index)
 Removes a property for an object that is being deleted from the derived class. More...
 
void clean_properties ()
 While preserving the properties themself, all values in the property are deleted. More...
 

Protected Attributes

std::vector< Joint * > joints_
 Joints of the skeleton.
 
std::map< std::string,
unsigned int > 
names_
 Binds a name to each animation.
 
std::vector< Animation * > animations_
 Animations defined on the skeleton.
 
Pose referencePose_
 The skeletons reference pose.
 
- Protected Attributes inherited from Properties
std::map< std::string, int > property_names_
 The property names, key holding the name, value the properties index in Properties::properties_.
 
std::vector< BaseProperty * > properties_
 A vector holding the properties. More...
 
unsigned long size_
 The number of fields in each property, used when new properties have to be created.
 

Friends

template<typename >
class JointT
 

Detailed Description

template<class PointT>
class SkeletonT< PointT >

Definition at line 56 of file JointT.hh.

Constructor & Destructor Documentation

template<typename PointT >
SkeletonT< PointT >::SkeletonT ( )

Default constructor.

Default Constructor.

Definition at line 377 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT >::SkeletonT ( const SkeletonT< PointT > &  _other)

Copy constructor.

Copy Constructor - Creates a copy of the given skeleton.

The copy does not inherit properties. You have to copy them yourself if you need them in the clone.

Definition at line 389 of file SkeletonT.cc.

Member Function Documentation

template<typename PointT >
AnimationHandle SkeletonT< PointT >::addAnimation ( std::string  _name,
Animation _animation 
)

Adds a new animation to the list.

The name is used to identify the animation. The AnimationHandle to the animation becomes invalid as soon as an animation is removed.

Definition at line 775 of file SkeletonT.cc.

template<typename PointT >
void SkeletonT< PointT >::addJoint ( typename SkeletonT< PointT >::Joint _pParent,
typename SkeletonT< PointT >::Joint _pJoint 
)

Adds a joint as child of a given parent joint.

Pass 0 as parent if you want to set a new root joint. This will remove all joints from the skeleton, clean the properties and clear all animation data.

Parameters
_pParentThe parent joint, 0 if the root is set
_pJointThe joint that has to be added to the tree

Definition at line 494 of file SkeletonT.cc.

template<typename PointT >
unsigned int SkeletonT< PointT >::animationCount ( )

Returns the number of animations stored in this skeleton.

See also
animationName

Definition at line 971 of file SkeletonT.cc.

template<typename PointT >
const std::string & SkeletonT< PointT >::animationName ( unsigned int  _index)

Returns the name of the animation with the given index.

See also
animationCount

Definition at line 984 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT >::AnimationIterator SkeletonT< PointT >::animationsBegin ( )

Iterator over the animations.

Returns an iterator pointing to the first animation.

Definition at line 945 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT >::Iterator SkeletonT< PointT >::begin ( )

Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)

Returns an iterator pointing to the root joint.

Use the iterator to traverse the skeleton in a top-down, "left-to-right" manner.

Definition at line 714 of file SkeletonT.cc.

template<typename PointT >
unsigned int SkeletonT< PointT >::child ( unsigned int  _joint,
unsigned int  _child 
)

Returns the child with the given index.

Parameters
_jointAn index identifying a joint
_childAn index identifying a child of that joint

Definition at line 690 of file SkeletonT.cc.

template<typename PointT >
void SkeletonT< PointT >::clear ( void  )
inline

Removes all joints from the skeleton.

This method also frees the memory occupied by the joints calling delete on each of them. Notice that all animations will be deleted as well, since without joint there cannot be animation. Also the properties are cleaned.

Definition at line 599 of file SkeletonT.cc.

template<typename PointT >
AnimationHandle SkeletonT< PointT >::cloneAnimation ( std::string  _name,
const AnimationHandle _hAni 
)

Creates a new animation by cloning an existing one.

All poses for all joints in all frames of the existing animation will be cloned. If the animation handle is invalid a copy of the default pose will be created.

Definition at line 809 of file SkeletonT.cc.

template<typename PointT >
void SkeletonT< PointT >::insertJoint ( typename SkeletonT< PointT >::Joint _pChild,
typename SkeletonT< PointT >::Joint _pInsert 
)

insert a Joint given its future child joint

Parameters
_pChildexisting joint, will be the child
_pInsertjoint, which will be inserted. _pChild will be his child and the parent of _pChild will be his parent.

Definition at line 1024 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT >::Joint * SkeletonT< PointT >::joint ( const unsigned int &  _index)
inline

Returns the joint with the given index.

JointT<>::id_ is always equal to _index.

Parameters
_indexThe joints index, in the range [0, SkeletonT<>::jointCount)
Returns
Returns a pointer to the joint or 0 if the index does not exist.

Definition at line 642 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT > & SkeletonT< PointT >::operator= ( const SkeletonT< PointT > &  _other)

Assignment operator.

Assignment operator - returns a copy of the skeleton.

The copy does not inherit properties. You have to copy them yourself if you need them in the clone.

Definition at line 431 of file SkeletonT.cc.

template<typename PointT >
int SkeletonT< PointT >::parent ( unsigned int  _joint)

Returns the parents id of the given node.

Parameters
_jointA nodes index
Returns
The parent nodes index or -1 if _joint is the root node

Definition at line 658 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT >::Pose * SkeletonT< PointT >::pose ( const AnimationHandle _hAni)
inline

Returns a pointer to the pose with the given animation handle.

If the animation handle is invalid the reference pose is returned.

Definition at line 741 of file SkeletonT.cc.

template<typename PointT >
SkeletonT< PointT >::Pose * SkeletonT< PointT >::referencePose ( )
inline

Returns a pointer to the reference pose.

Use this if you need access to the special data members of the reference pose. Notice you can also get the reference pose by passing AnimationHandle() to the SkeletonT<>::pose method:

Definition at line 761 of file SkeletonT.cc.

template<typename PointT >
void SkeletonT< PointT >::removeJoint ( typename SkeletonT< PointT >::Joint _pJoint)

Remove the given joint from the tree.

This method will not only remove the given joint from the vector, it will also reduce the index of all joints with a larger index by one. This is to compensate for their new position in the vector and to make sure the sequence of indices is still continuous.

Also all poses and properties are updated.

Definition at line 538 of file SkeletonT.cc.

template<class PointT>
void SkeletonT< PointT >::replaceAnimationName ( const std::string &  _strOld,
const std::string &  _strNew 
)
inline

Returns a pointer to the pose with the given animation handle.

If the animation handle is invalid the reference pose is returned.

Definition at line 196 of file SkeletonT.hh.

template<typename PointT >
SkeletonT< PointT >::Joint * SkeletonT< PointT >::root ( )
inline

Returns the root joint.

The root joint has always index 0.

Returns
Returns the root joint or 0 if the tree is empty

Definition at line 624 of file SkeletonT.cc.

template<typename PointT >
void SkeletonT< PointT >::updateFromGlobal ( unsigned int  _idJoint)
protected

update the structure when parent changes for a joint

Updates the local matrix for the given joint in all poses.

Parameters
_idJointThe joints index

Definition at line 1006 of file SkeletonT.cc.


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