Motive Animation System
An open source project by FPL.
 All Classes Functions Variables Typedefs Friends Pages
motive::RigAnim Class Reference

Animation for a RigMotivator. Drives a fully rigged model. More...

#include <anim.h>

Detailed Description

Animation for a RigMotivator. Drives a fully rigged model.

Public Member Functions

void Init (const char *anim_name, BoneIndex num_bones, bool record_names)
 
MatrixAnimInitMatrixAnim (BoneIndex idx, BoneIndex parent, const char *bone_name)
 
const MatrixAnimAnim (BoneIndex idx) const
 Return the animation of the idxth bone. Each bone animates a matrix.
 
BoneIndex NumBones () const
 
const char * BoneName (BoneIndex idx) const
 
int NumOps () const
 Total number of matrix operations across all MatrixAnims in this RigAnim.
 
void GetSplinesAndConstants (BoneIndex bone, const MatrixOperationType *ops, int num_ops, const CompactSpline **splines, float *constants) const
 
int NumCsvHeaderLines () const
 
std::string CsvHeaderForDebugging (int line) const
 
MotiveTime end_time () const
 
void set_end_time (MotiveTime t)
 
const BoneIndex * bone_parents () const
 
bool repeat () const
 
bool set_repeat (bool repeat)
 Set the repeat flag.
 
const std::string & anim_name () const
 

Member Function Documentation

const std::string& motive::RigAnim::anim_name ( ) const
inline

For debugging. The name of the animation currently being played. Only valid if record_names is true in Init().

const BoneIndex* motive::RigAnim::bone_parents ( ) const
inline

Returns an array of length NumBones() representing the bone heirarchy. bone_parents()[i] is the bone index of the ith bone's parent. bone_parents()[i] < bone_parents()[j] for all i < j. For bones at the root (i.e. no parent) value is kInvalidBoneIdx.

const char* motive::RigAnim::BoneName ( BoneIndex  idx) const
inline

For debugging. If record_names was specified in Init(), the names of the bones are stored. Very useful when an animation is applied to a mesh that doesn't match: with the bone names you can determine whether the mesh or the animation is out of date.

std::string motive::RigAnim::CsvHeaderForDebugging ( int  line) const

Output a line of comma-separated-values that has header information for the CSV data output by RigMotivator::CsvValues().

MotiveTime motive::RigAnim::end_time ( ) const
inline

Amount of time required by this animation. Time units are set by the caller. If animation repeats, returns infinity. TODO: Add function to return non-repeated end time, even when repeatable.

void motive::RigAnim::GetSplinesAndConstants ( BoneIndex  bone,
const MatrixOperationType *  ops,
int  num_ops,
const CompactSpline **  splines,
float *  constants 
) const

Gets the splines and constants that drive the operations in ops, for the specified bone. If an operation is not driven by the bone, return the default value for that op in constants.

If the bone has multiple operations that match ops[i], return the first one.

Parameters
boneThe bone whose operations you want to pull data for.
opsAnd array of length num_ops with the operations you're interested in. num_ops Length of the ops array. splines Output array, length num_ops. For each element of ops, receives the driving spline, or nullptr if that operation is not driven by a spline. constants Output array, length num_ops. For each element of ops, receives the constant value of that operation, if no spline drives that operation.
void motive::RigAnim::Init ( const char *  anim_name,
BoneIndex  num_bones,
bool  record_names 
)

Initialize the basic data. After calling this function, InitMatrixAnim() should be called once for every bone in the animation.

MatrixAnim& motive::RigAnim::InitMatrixAnim ( BoneIndex  idx,
BoneIndex  parent,
const char *  bone_name 
)

For construction. Return the idxth bone's animation for initialization.

Parameters
idxThe bone whose animation you want to initialize.
parentIf no parent exists, pass in kInvalidBoneIdx.
bone_nameFor debugging. Recorded if record_names was true in Init().
BoneIndex motive::RigAnim::NumBones ( ) const
inline

Number of bones. Bones are arranged in an hierarchy. Each bone animates a matrix. The matrix describes the transform of the bone from its parent.

int motive::RigAnim::NumCsvHeaderLines ( ) const
inline

For debugging. The number of lines in the header. You call them separately in case you want to prefix or append extra columns.

bool motive::RigAnim::repeat ( ) const
inline

Animation is repeatable. That is, when the end of the animation is reached, it can be started at the beginning again without glitching. Generally, an animation is repeatable if it's curves have the same values and derivatives at the start and end.

void motive::RigAnim::set_end_time ( MotiveTime  t)
inline

For construction. The end time should be set to the maximal end time of all the anims_.


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