Developer Documentation

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
SkeletonT< PointT > Class Template Reference
Inheritance diagram for SkeletonT< PointT >:

## 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...
SkeletonT & | operator= (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.
Joint * | root ()
| Returns the root joint. More...
Joint * | joint (const size_t &_index)
| Returns the joint with the given index. More...
int | parent (size_t _joint)
| Returns the parents id of the given node. More...
size_t | childCount (size_t _joint)
| Returns the number of children of the given node.
size_t | child (size_t _joint, size_t _child)
| Returns the child with the given index. More...
size_t | 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.
Pose * | pose (const AnimationHandle &_hAni)
| Returns a pointer to the pose with the given animation handle. More...
Pose * | referencePose ()
| 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.
Animation * | animation (std::string _name)
| Returns a pointer to the animation to the given name.
Animation * | animation (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.
size_t | animationCount ()
| Returns the number of animations stored in this skeleton. More...
const std::string & | animationName (size_t _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 (size_t _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, size_t > | 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 50 of file JointT.hh.

## Constructor & Destructor Documentation

## ◆ SkeletonT() [1/2]

template<typename PointT >

SkeletonT< PointT >::SkeletonT | ( |  | ) |

Default constructor.

Default Constructor.

Definition at line 371 of file SkeletonT_impl.hh.

## ◆ SkeletonT() [2/2]

template<typename PointT >

SkeletonT< PointT >::SkeletonT | ( | const SkeletonT< PointT > & | _other | ) |
| explicit

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 383 of file SkeletonT_impl.hh.

## Member Function Documentation

## ◆ addAnimation()

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 769 of file SkeletonT_impl.hh.

## ◆ addJoint()

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

  _pParent | The parent joint, 0 if the root is set
  _pJoint | The joint that has to be added to the tree

Definition at line 488 of file SkeletonT_impl.hh.

## ◆ animationCount()

template<typename PointT >

size_t SkeletonT< PointT >::animationCount | ( |  | ) |

Returns the number of animations stored in this skeleton.

See also
  animationName

Definition at line 965 of file SkeletonT_impl.hh.

## ◆ animationName()

template<typename PointT >

const std::string & SkeletonT< PointT >::animationName | ( | size_t | _index | ) |

Returns the name of the animation with the given index.

See also
  animationCount

Definition at line 978 of file SkeletonT_impl.hh.

## ◆ animationsBegin()

template<typename PointT >

SkeletonT< PointT >::AnimationIterator SkeletonT< PointT >::animationsBegin | ( |  | ) |

Iterator over the animations.

Returns an iterator pointing to the first animation.

Definition at line 939 of file SkeletonT_impl.hh.

## ◆ begin()

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 708 of file SkeletonT_impl.hh.

## ◆ child()

template<typename PointT >

size_t SkeletonT< PointT >::child | ( | size_t | _joint,
|  | size_t | _child
| ) |  |

Returns the child with the given index.

Parameters

  _joint | An index identifying a joint
  _child | An index identifying a child of that joint

Definition at line 684 of file SkeletonT_impl.hh.

## ◆ clear()

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 593 of file SkeletonT_impl.hh.

## ◆ cloneAnimation()

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 803 of file SkeletonT_impl.hh.

## ◆ insertJoint()

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

  _pChild | existing joint, will be the child
  _pInsert | joint, which will be inserted. _pChild will be his child and the parent of _pChild will be his parent.

Definition at line 1016 of file SkeletonT_impl.hh.

## ◆ joint()

template<typename PointT >

SkeletonT< PointT >::Joint * SkeletonT< PointT >::joint | ( | const size_t & | _index | ) |
| inline

Returns the joint with the given index.

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

Parameters

  _index | The 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 636 of file SkeletonT_impl.hh.

## ◆ operator=()

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 425 of file SkeletonT_impl.hh.

## ◆ parent()

template<typename PointT >

int SkeletonT< PointT >::parent | ( | size_t | _joint | ) |

Returns the parents id of the given node.

Parameters

  _joint | A nodes index

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

Definition at line 652 of file SkeletonT_impl.hh.

## ◆ pose()

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 735 of file SkeletonT_impl.hh.

## ◆ referencePose()

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:

skeleton.pose(AnimationHandle());

Definition at line 755 of file SkeletonT_impl.hh.

## ◆ removeJoint()

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 532 of file SkeletonT_impl.hh.

## ◆ replaceAnimationName()

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 190 of file SkeletonT.hh.

## ◆ root()

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 618 of file SkeletonT_impl.hh.

## ◆ updateFromGlobal()

template<typename PointT >

void SkeletonT< PointT >::updateFromGlobal | ( | size_t | _idJoint | ) |
| protected

update the structure when parent changes for a joint

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

Parameters

  _idJoint | The joints index

Definition at line 998 of file SkeletonT_impl.hh.

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

- Type-Skeleton/ObjectTypes/Skeleton/JointT.hh
- Type-Skeleton/ObjectTypes/Skeleton/SkeletonT.hh
- Type-Skeleton/ObjectTypes/Skeleton/SkeletonT_impl.hh