A skeleton, usually used for animation purposes. More...
#include <gz/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... | |
SkeletonAnimation * | Animation (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... | |
SkeletonNode * | NodeByHandle (const unsigned int _handle) const |
Find or create node with handle. More... | |
SkeletonNode * | NodeById (const std::string &_id) const |
Find node by index. More... | |
SkeletonNode * | NodeByName (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 SkeletonNodeMap & | Nodes () const |
Get a copy or the node dictionary. More... | |
void | PrintTransforms () const |
Outputs the transforms to standard out. More... | |
SkeletonNode * | RootNode () const |
Return the root. More... | |
void | RootNode (SkeletonNode *_node) |
Change the root node. 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]
|
explicit |
Constructor.
- Parameters
-
[in] _root node
◆ ~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
◆ AddBvhAnimation()
bool AddBvhAnimation | ( | const std::string & | _bvhFile, |
double | _scale | ||
) |
Add an animation from BVH file.
- Parameters
-
[in] _bvhFile the bvh file to load animation from [in] _scale the 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] _vertex index of the vertex [in] _node name of the bone [in] _weight the 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] _index the animation index [in] _animNodeName the 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] _index the animation index [in] _animNodeName the animation node name
- Returns
- The transformation to align translation
◆ Animation()
SkeletonAnimation* Animation | ( | const unsigned int | _i | ) | const |
Find animation.
- Parameters
-
[in] _i the 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] _id the index
- Returns
- the node, or NULL if not found
◆ NodeByName()
SkeletonNode* NodeByName | ( | const std::string & | _name | ) | const |
Find a node.
- Parameters
-
[in] _name the 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] _index the animation index [in] _animNodeName the 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]
SkeletonNode* RootNode | ( | ) | const |
Return the root.
- Returns
- the root
◆ RootNode() [2/2]
void RootNode | ( | SkeletonNode * | _node | ) |
Change the root node.
- Parameters
-
[in] _node the new node
◆ Scale()
void Scale | ( | const double | _scale | ) |
Scale all nodes, transforms and animation data.
- Parameters
-
[in] the scaling factor
◆ SetBindShapeTransform()
void SetBindShapeTransform | ( | const math::Matrix4d & | _trans | ) |
Set the bind pose skeletal transform.
- Parameters
-
[in] _trans the transform
◆ SetNumVertAttached()
void SetNumVertAttached | ( | const unsigned int | _vertices | ) |
Resizes the raw node weight array.
- Parameters
-
[in] _vertices the 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] _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
◆ VertNodeWeightCount()
unsigned int VertNodeWeightCount | ( | const unsigned int | _vertex | ) | const |
Returns the number of bone weights for a vertex.
- Parameters
-
[in] _vertex the index of the vertex
- Returns
- the count
The documentation for this class was generated from the following file: