Developer Documentation
|
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 | |
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 | |
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 |
|
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.
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.
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.
_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.
size_t SkeletonT< PointT >::animationCount | ( | ) |
Returns the number of animations stored in this skeleton.
Definition at line 965 of file SkeletonT_impl.hh.
const std::string & SkeletonT< PointT >::animationName | ( | size_t | _index | ) |
Returns the name of the animation with the given index.
Definition at line 978 of file SkeletonT_impl.hh.
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.
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.
size_t SkeletonT< PointT >::child | ( | size_t | _joint, |
size_t | _child | ||
) |
Returns the child with the given index.
_joint | An index identifying a joint |
_child | An index identifying a child of that joint |
Definition at line 684 of file SkeletonT_impl.hh.
|
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.
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.
void SkeletonT< PointT >::insertJoint | ( | typename SkeletonT< PointT >::Joint * | _pChild, |
typename SkeletonT< PointT >::Joint * | _pInsert | ||
) |
insert a Joint given its future child joint
_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.
|
inline |
Returns the joint with the given index.
JointT<>::id_ is always equal to _index.
_index | The joints index, in the range [0, SkeletonT<>::jointCount) |
Definition at line 636 of file SkeletonT_impl.hh.
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.
int SkeletonT< PointT >::parent | ( | size_t | _joint | ) |
Returns the parents id of the given node.
_joint | A nodes index |
Definition at line 652 of file SkeletonT_impl.hh.
|
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.
|
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 755 of file SkeletonT_impl.hh.
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.
|
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.
Returns the root joint.
The root joint has always index 0.
Definition at line 618 of file SkeletonT_impl.hh.
|
protected |
update the structure when parent changes for a joint
Updates the local matrix for the given joint in all poses.
_idJoint | The joints index |
Definition at line 998 of file SkeletonT_impl.hh.