19 #include "motive/init.h"
20 #include "motive/math/compact_spline.h"
29 Spline() : spline(
nullptr) {}
38 explicit MatrixAnim(
int expected_num_ops = 0) : ops_(expected_num_ops) {}
44 if (num_splines == 0)
return nullptr;
50 splines_.resize(num_splines);
51 return splines_.data();
67 std::vector<Spline> splines_;
74 RigAnim() : end_time_(0), repeat_(
false) {}
78 void Init(
const char*
anim_name, BoneIndex num_bones,
bool record_names);
86 const char* bone_name);
90 assert(idx < anims_.size());
96 BoneIndex
NumBones()
const {
return static_cast<BoneIndex
>(anims_.size()); }
103 return idx < bone_names_.size() ? bone_names_[idx].c_str() :
"unknown";
128 float* constants)
const;
164 const std::string&
anim_name()
const {
return anim_name_; }
167 std::vector<MatrixAnim> anims_;
168 std::vector<BoneIndex> bone_parents_;
169 std::vector<std::string> bone_names_;
170 MotiveTime end_time_;
172 std::string anim_name_;
177 #endif // MOTIVE_ANIM_H
const BoneIndex * bone_parents() const
Definition: anim.h:151
const MatrixAnim & Anim(BoneIndex idx) const
Return the animation of the idxth bone. Each bone animates a matrix.
Definition: anim.h:89
Animation for a MatrixMotivator. Drives a single bone's transform.
Definition: anim.h:26
Animation for a RigMotivator. Drives a fully rigged model.
Definition: anim.h:72
void set_end_time(MotiveTime t)
Definition: anim.h:145
Initialize a MotivatorNf to follow a spline.
Definition: init.h:317
const char * BoneName(BoneIndex idx) const
Definition: anim.h:102
const std::string & anim_name() const
Definition: anim.h:164
bool set_repeat(bool repeat)
Set the repeat flag.
Definition: anim.h:160
bool repeat() const
Definition: anim.h:157
const MatrixOpArray & ops() const
Return the op array. Const version is to initialize a MatrixMotivator.
Definition: anim.h:58
static void Destroy(CompactSpline *spline)
Definition: compact_spline.h:404
void Init(const char *anim_name, BoneIndex num_bones, bool record_names)
std::string CsvHeaderForDebugging(int line) const
MatrixAnim & InitMatrixAnim(BoneIndex idx, BoneIndex parent, const char *bone_name)
int NumOps() const
Total number of matrix operations across all MatrixAnims in this RigAnim.
MotiveTime end_time() const
Definition: anim.h:141
BoneIndex NumBones() const
Definition: anim.h:96
int NumCsvHeaderLines() const
Definition: anim.h:132
void GetSplinesAndConstants(BoneIndex bone, const MatrixOperationType *ops, int num_ops, const CompactSpline **splines, float *constants) const
Represent a smooth curve in a small amount of memory.
Definition: compact_spline.h:73
MatrixOpArray & ops()
Return the op array. Non-const version is for construction.
Definition: anim.h:55
Spline * Construct(int num_splines)
Definition: anim.h:43