Skeleton Class Reference

A skeleton. More...

#include <common/common.hh>

Public Member Functions

 Skeleton ()
 Constructor. More...
 
 Skeleton (SkeletonNode *_root)
 Constructor. More...
 
virtual ~Skeleton ()
 Destructor. More...
 
void AddAnimation (SkeletonAnimation *_anim)
 Add an animation. More...
 
void AddVertNodeWeight (unsigned int _vertex, std::string _node, double _weight)
 Add a new weight to a node (bone) More...
 
ignition::math::Matrix4d BindShapeTransform ()
 Return bind pose skeletal transform. More...
 
SkeletonAnimationGetAnimation (const unsigned int _i)
 Find animation. More...
 
SkeletonNodeGetNodeByHandle (unsigned int _handle)
 Find or create node with handle. More...
 
SkeletonNodeGetNodeById (std::string _id)
 Find node by index. More...
 
SkeletonNodeGetNodeByName (std::string _name)
 Find a node. More...
 
NodeMap GetNodes ()
 Get a copy or the node dictionary. More...
 
unsigned int GetNumAnimations ()
 Returns the number of animations. More...
 
unsigned int GetNumJoints ()
 Returns the number of joints. More...
 
unsigned int GetNumNodes ()
 Returns the node count. More...
 
unsigned int GetNumVertNodeWeights (unsigned int _vertex)
 Returns the number of bone weights for a vertex. More...
 
SkeletonNodeGetRootNode ()
 Return the root. More...
 
std::pair< std::string, double > GetVertNodeWeight (unsigned int _v, unsigned int _i)
 Weight of a bone for a vertex. More...
 
void PrintTransforms ()
 Outputs the transforms to std::err stream. More...
 
void Scale (double _scale)
 Scale all nodes, transforms and animation data. More...
 
void SetBindShapeTransform (const ignition::math::Matrix4d &_trans)
 Set the bind pose skeletal transform. More...
 
void SetNumVertAttached (unsigned int _vertices)
 Resizes the raw node weight array. More...
 
void SetRootNode (SkeletonNode *_node)
 Change the root node. More...
 

Protected Member Functions

void BuildNodeMap ()
 Initializes the hande numbers for each node in the map using breadth first traversal. More...
 

Protected Attributes

std::vector< SkeletonAnimation * > anims
 the array of animations More...
 
ignition::math::Matrix4d bindShapeTransform
 the bind pose skeletal transform More...
 
NodeMap nodes
 The dictionary of nodes, indexed by name. More...
 
RawNodeWeights rawNW
 the node weight table More...
 
SkeletonNoderoot
 the root node More...
 

Detailed Description

A skeleton.

Constructor & Destructor Documentation

Skeleton ( )

Constructor.

Skeleton ( SkeletonNode _root)
explicit

Constructor.

Parameters
[in]_rootnode
virtual ~Skeleton ( )
virtual

Destructor.

Member Function Documentation

void AddAnimation ( SkeletonAnimation _anim)

Add an animation.

The skeleton does not take ownership of the animation

Parameters
[in]_animthe animation to add
void AddVertNodeWeight ( unsigned int  _vertex,
std::string  _node,
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)
ignition::math::Matrix4d BindShapeTransform ( )

Return bind pose skeletal transform.

Returns
a matrix
void BuildNodeMap ( )
protected

Initializes the hande numbers for each node in the map using breadth first traversal.

SkeletonAnimation* GetAnimation ( const unsigned int  _i)

Find animation.

Parameters
[in]_ithe animation index
Returns
the animation, or nullptr if _i is out of bounds
SkeletonNode* GetNodeByHandle ( unsigned int  _handle)

Find or create node with handle.

Parameters
[in]_handle
Returns
the node. A new node is created if it didn't exist
SkeletonNode* GetNodeById ( std::string  _id)

Find node by index.

Parameters
[in]_idthe index
Returns
the node, or nullptr if not found
SkeletonNode* GetNodeByName ( std::string  _name)

Find a node.

Parameters
[in]_namethe name of the node to look for
Returns
the node, or nullptr if not found
NodeMap GetNodes ( )

Get a copy or the node dictionary.

unsigned int GetNumAnimations ( )

Returns the number of animations.

Returns
the count
unsigned int GetNumJoints ( )

Returns the number of joints.

Returns
the count
unsigned int GetNumNodes ( )

Returns the node count.

Returns
the count
unsigned int GetNumVertNodeWeights ( unsigned int  _vertex)

Returns the number of bone weights for a vertex.

Parameters
[in]_vertexthe index of the vertex
Returns
the count
SkeletonNode* GetRootNode ( )

Return the root.

Returns
the root
std::pair<std::string, double> GetVertNodeWeight ( unsigned int  _v,
unsigned int  _i 
)

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
void PrintTransforms ( )

Outputs the transforms to std::err stream.

void Scale ( double  _scale)

Scale all nodes, transforms and animation data.

Parameters
[in]thescaling factor
void SetBindShapeTransform ( const ignition::math::Matrix4d &  _trans)

Set the bind pose skeletal transform.

Parameters
[in]_transthe transform
void SetNumVertAttached ( unsigned int  _vertices)

Resizes the raw node weight array.

Parameters
[in]_verticesthe new size
void SetRootNode ( SkeletonNode _node)

Change the root node.

Parameters
[in]_nodethe new node

Member Data Documentation

std::vector<SkeletonAnimation*> anims
protected

the array of animations

ignition::math::Matrix4d bindShapeTransform
protected

the bind pose skeletal transform

NodeMap nodes
protected

The dictionary of nodes, indexed by name.

RawNodeWeights rawNW
protected

the node weight table

SkeletonNode* root
protected

the root node


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