Ignition Common

API Reference

4.4.0
Skeleton Class Reference

A skeleton, usually used for animation purposes. More...

#include <ignition/common/Skeleton.hh>

Public Member Functions

 Skeleton ()
 Constructor. More...
 
 Skeleton (SkeletonNode *_root)
 Constructor. More...
 
virtual ~Skeleton ()
 Destructor. More...
 
void AddAnimation (SkeletonAnimation *_anim)
 Add an animation. The skeleton does not take ownership of the animation. More...
 
bool AddBvhAnimation (const std::string &_bvhFile, double _scale)
 Add an animation from BVH file. More...
 
void AddVertNodeWeight (const unsigned int _vertex, const std::string &_node, const double _weight)
 Add a new weight to a node (bone) More...
 
math::Matrix4d AlignRotation (unsigned int _index, const std::string &_animNodeName)
 Get the transformation to align rotation from the animation skeleton to skin skeleton. More...
 
math::Matrix4d AlignTranslation (unsigned int _index, const std::string &_animNodeName)
 Get the transformation to align translation from the animation skeleton to skin skeleton. More...
 
SkeletonAnimationAnimation (const unsigned int _i) const
 Find animation. More...
 
unsigned int AnimationCount () const
 Returns the number of animations. More...
 
math::Matrix4d BindShapeTransform () const
 Return bind pose skeletal transform. More...
 
unsigned int JointCount () const
 Returns the number of joints. More...
 
SkeletonNodeNodeByHandle (const unsigned int _handle) const
 Find or create node with handle. More...
 
SkeletonNodeNodeById (const std::string &_id) const
 Find node by index. More...
 
SkeletonNodeNodeByName (const std::string &_name) const
 Find a node. More...
 
unsigned int NodeCount () const
 Returns the node count. More...
 
std::string NodeNameAnimToSkin (unsigned int _index, const std::string &_animNodeName)
 Finding the skin node name that corresponds to the given animation node name. More...
 
const SkeletonNodeMapNodes () const
 Get a copy or the node dictionary. More...
 
void PrintTransforms () const
 Outputs the transforms to standard out. More...
 
void RootNode (SkeletonNode *_node)
 Change the root node. More...
 
SkeletonNodeRootNode () const
 Return the root. More...
 
void Scale (const double _scale)
 Scale all nodes, transforms and animation data. More...
 
void SetBindShapeTransform (const math::Matrix4d &_trans)
 Set the bind pose skeletal transform. More...
 
void SetNumVertAttached (const unsigned int _vertices)
 Resizes the raw node weight array. More...
 
std::pair< std::string, double > VertNodeWeight (const unsigned int _v, const unsigned int _i) const
 Weight of a bone for a vertex. More...
 
unsigned int VertNodeWeightCount (const unsigned int _vertex) const
 Returns the number of bone weights for a vertex. More...
 

Detailed Description

A skeleton, usually used for animation purposes.

Constructor & Destructor Documentation

◆ Skeleton() [1/2]

Skeleton ( )

Constructor.

◆ Skeleton() [2/2]

Skeleton ( SkeletonNode _root)
explicit

Constructor.

Parameters
[in]_rootnode

◆ ~Skeleton()

virtual ~Skeleton ( )
virtual

Destructor.

Member Function Documentation

◆ AddAnimation()

void AddAnimation ( SkeletonAnimation _anim)

Add an animation. The skeleton does not take ownership of the animation.

Parameters
[in]_animthe animation to add

◆ AddBvhAnimation()

bool AddBvhAnimation ( const std::string _bvhFile,
double  _scale 
)

Add an animation from BVH file.

Parameters
[in]_bvhFilethe bvh file to load animation from
[in]_scalethe scale of the animation
Returns
True if the BVH animation is compatible with skeleton

◆ AddVertNodeWeight()

void AddVertNodeWeight ( const unsigned int  _vertex,
const std::string _node,
const double  _weight 
)

Add a new weight to a node (bone)

Parameters
[in]_vertexindex of the vertex
[in]_nodename of the bone
[in]_weightthe new weight (range 0 to 1)

◆ AlignRotation()

math::Matrix4d AlignRotation ( unsigned int  _index,
const std::string _animNodeName 
)

Get the transformation to align rotation from the animation skeleton to skin skeleton.

Parameters
[in]_indexthe animation index
[in]_animNodeNamethe animation node name
Returns
The transformation to align rotation

◆ AlignTranslation()

math::Matrix4d AlignTranslation ( unsigned int  _index,
const std::string _animNodeName 
)

Get the transformation to align translation from the animation skeleton to skin skeleton.

Parameters
[in]_indexthe animation index
[in]_animNodeNamethe animation node name
Returns
The transformation to align translation

◆ Animation()

SkeletonAnimation* Animation ( const unsigned int  _i) const

Find animation.

Parameters
[in]_ithe animation index
Returns
the animation, or NULL if _i is out of bounds

◆ AnimationCount()

unsigned int AnimationCount ( ) const

Returns the number of animations.

Returns
the count

◆ BindShapeTransform()

math::Matrix4d BindShapeTransform ( ) const

Return bind pose skeletal transform.

Returns
A matrix

◆ JointCount()

unsigned int JointCount ( ) const

Returns the number of joints.

Returns
the count

◆ NodeByHandle()

SkeletonNode* NodeByHandle ( const unsigned int  _handle) const

Find or create node with handle.

Parameters
[in]_handle
Returns
the node. A new node is created if it didn't exist

◆ NodeById()

SkeletonNode* NodeById ( const std::string _id) const

Find node by index.

Parameters
[in]_idthe index
Returns
the node, or NULL if not found

◆ NodeByName()

SkeletonNode* NodeByName ( const std::string _name) const

Find a node.

Parameters
[in]_namethe name of the node to look for
Returns
the node, or NULL if not found

◆ NodeCount()

unsigned int NodeCount ( ) const

Returns the node count.

Returns
the count

◆ NodeNameAnimToSkin()

std::string NodeNameAnimToSkin ( unsigned int  _index,
const std::string _animNodeName 
)

Finding the skin node name that corresponds to the given animation node name.

Parameters
[in]_indexthe animation index
[in]_animNodeNamethe given animation node name
Returns
The corresponding skin node name in the skeleton

◆ Nodes()

const SkeletonNodeMap& Nodes ( ) const

Get a copy or the node dictionary.

Returns
A copy of the nodes.

◆ PrintTransforms()

void PrintTransforms ( ) const

Outputs the transforms to standard out.

◆ RootNode() [1/2]

void RootNode ( SkeletonNode _node)

Change the root node.

Parameters
[in]_nodethe new node

◆ RootNode() [2/2]

SkeletonNode* RootNode ( ) const

Return the root.

Returns
the root

◆ Scale()

void Scale ( const double  _scale)

Scale all nodes, transforms and animation data.

Parameters
[in]thescaling factor

◆ SetBindShapeTransform()

void SetBindShapeTransform ( const math::Matrix4d _trans)

Set the bind pose skeletal transform.

Parameters
[in]_transthe transform

◆ SetNumVertAttached()

void SetNumVertAttached ( const unsigned int  _vertices)

Resizes the raw node weight array.

Parameters
[in]_verticesthe new size

◆ VertNodeWeight()

std::pair<std::string, double> VertNodeWeight ( const unsigned int  _v,
const unsigned int  _i 
) const

Weight of a bone for a vertex.

Parameters
[in]_vthe index of the vertex
[in]_ithe index of the weight for that vertex
Returns
a pair containing the name of the node and the weight

◆ VertNodeWeightCount()

unsigned int VertNodeWeightCount ( const unsigned int  _vertex) const

Returns the number of bone weights for a vertex.

Parameters
[in]_vertexthe index of the vertex
Returns
the count

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