##

Skeleton Class Reference
Common

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...
SkeletonAnimation * | GetAnimation (const unsigned int _i)
| Find animation. More...
SkeletonNode * | GetNodeByHandle (unsigned int _handle)
| Find or create node with handle. More...
SkeletonNode * | GetNodeById (std::string _id)
| Find node by index. More...
SkeletonNode * | GetNodeByName (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...
SkeletonNode * | GetRootNode ()
| Return the root. More...
const SkeletonNode * | GetRootNode () const
| 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, this also clears all the node weights assigned. 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...
SkeletonNode * | root
| the root node More...

## Detailed Description

A skeleton.

## Constructor & Destructor Documentation

## Skeleton() [1/2]

Skeleton | ( |  | ) |

Constructor.

## Skeleton() [2/2]

Skeleton | ( | SkeletonNode * | _root | ) |

explicit

Constructor.

Parameters

  [in] | _root | node

## ~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] | _anim | the animation to add

## AddVertNodeWeight()

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

Add a new weight to a node (bone)

Parameters

  [in] | _vertex | index of the vertex
  [in] | _node | name of the bone
  [in] | _weight | the new weight (range 0 to 1)

## BindShapeTransform()

ignition::math::Matrix4d BindShapeTransform | ( |  | ) |

Return bind pose skeletal transform.

Returns
  a matrix

## BuildNodeMap()

void BuildNodeMap | ( |  | ) |

protected

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

## GetAnimation()

SkeletonAnimation* GetAnimation | ( | const unsigned int | _i | ) |

Find animation.

Parameters

  [in] | _i | the animation index

Returns
  the animation, or nullptr if _i is out of bounds

## GetNodeByHandle()

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

## GetNodeById()

SkeletonNode* GetNodeById | ( | std::string | _id | ) |

Find node by index.

Parameters

  [in] | _id | the index

Returns
  the node, or nullptr if not found

## GetNodeByName()

SkeletonNode* GetNodeByName | ( | std::string | _name | ) |

Find a node.

Parameters

  [in] | _name | the name of the node to look for

Returns
  the node, or nullptr if not found

## GetNodes()

NodeMap GetNodes | ( |  | ) |

Get a copy or the node dictionary.

## GetNumAnimations()

unsigned int GetNumAnimations | ( |  | ) |

Returns the number of animations.

Returns
  the count

## GetNumJoints()

unsigned int GetNumJoints | ( |  | ) |

Returns the number of joints.

Returns
  the count

## GetNumNodes()

unsigned int GetNumNodes | ( |  | ) |

Returns the node count.

Returns
  the count

## GetNumVertNodeWeights()

unsigned int GetNumVertNodeWeights | ( | unsigned int | _vertex | ) |

Returns the number of bone weights for a vertex.

Parameters

  [in] | _vertex | the index of the vertex

Returns
  the count

## GetRootNode() [1/2]

SkeletonNode* GetRootNode | ( |  | ) |

Return the root.

Returns
  the root

## GetRootNode() [2/2]

const SkeletonNode* GetRootNode | ( |  | ) | const

Return the root.

Returns
  the root

## GetVertNodeWeight()

std::pair<std::string, double> GetVertNodeWeight | ( | unsigned int | _v,
|  | unsigned int | _i
| ) |  |

Weight of a bone for a vertex.

Parameters

  [in] | _v | the index of the vertex
  [in] | _i | the index of the weight for that vertex

Returns
  a pair containing the name of the node and the weight

## PrintTransforms()

void PrintTransforms | ( |  | ) |

Outputs the transforms to std::err stream.

## Scale()

void Scale | ( | double | _scale | ) |

Scale all nodes, transforms and animation data.

Parameters

  [in] | the | scaling factor

## SetBindShapeTransform()

void SetBindShapeTransform | ( | const ignition::math::Matrix4d & | _trans | ) |

Set the bind pose skeletal transform.

Parameters

  [in] | _trans | the transform

## SetNumVertAttached()

void SetNumVertAttached | ( | unsigned int | _vertices | ) |

Resizes the raw node weight array, this also clears all the node weights assigned.

Parameters

  [in] | _vertices | the new size

## SetRootNode()

void SetRootNode | ( | SkeletonNode * | _node | ) |

Change the root node.

Parameters

  [in] | _node | the new node

## Member Data Documentation

## anims

std::vector<SkeletonAnimation*> anims

protected

the array of animations

## bindShapeTransform

ignition::math::Matrix4d bindShapeTransform

protected

Initial value:
=
ignition::math::Matrix4d::Identity

the bind pose skeletal transform

## nodes

NodeMap nodes

protected

The dictionary of nodes, indexed by name.

## rawNW

RawNodeWeights rawNW

protected

the node weight table

## root

SkeletonNode* root

protected

the root node

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

- Skeleton.hh