24 TypeHandle EggMatrixTablePointer::_type_handle;
29 EggMatrixTablePointer::
30 EggMatrixTablePointer(
EggObject *
object) {
33 if (_table !=
nullptr) {
36 EggGroupNode::iterator ci;
38 for (ci = _table->begin(); ci != _table->end() && !found; ++ci) {
40 if (child->get_name() ==
"xform") {
41 if (child->
is_of_type(EggXfmSAnim::get_class_type())) {
46 }
else if (child->
is_of_type(EggXfmAnimData::get_class_type())) {
51 _table->replace(ci, _xform.p());
65 if (_xform ==
nullptr || !_xform->has_fps()) {
68 return _xform->get_fps();
77 if (_xform ==
nullptr) {
80 return _xform->get_num_rows();
89 nassertv(_xform !=
nullptr);
91 int num_rows = _xform->get_num_rows();
94 last_mat = LMatrix4d::ident_mat();
96 _xform->get_value(num_rows - 1, last_mat);
99 while (num_rows < num_frames) {
100 _xform->add_data(last_mat);
118 return LMatrix4d::ident_mat();
123 _xform->get_value(n, mat);
134 _xform->set_value(n, mat);
143 if (_xform ==
nullptr) {
147 return _xform->add_data(mat);
156 if (new_parent ==
nullptr) {
159 if (egg_parent !=
nullptr) {
160 egg_parent->remove_child(_table.p());
167 if (new_node->_table != _table->get_parent()) {
168 new_node->_table->add_child(_table.p());
186 if (!db.
get_matrix(
this, EggCharacterDb::TT_rebuild_frame, 0, mat)) {
191 if (_xform ==
nullptr) {
197 _xform->clear_data();
198 if (!_xform->add_data(mat)) {
204 while (db.
get_matrix(
this, EggCharacterDb::TT_rebuild_frame, n, mat)) {
205 if (!_xform->add_data(mat)) {
220 if (_xform !=
nullptr) {
230 if (_xform ==
nullptr) {
236 string::const_iterator si;
237 for (si = components.begin(); si != components.end(); ++si) {
238 string table_name(1, *si);
239 EggNode *child = _xform->find_child(table_name);
240 if (child !=
nullptr) {
241 _xform->remove_child(child);
252 if (_xform ==
nullptr) {
258 string::const_iterator si;
259 for (si = components.begin(); si != components.end(); ++si) {
260 string table_name(1, *si);
261 EggNode *child = _xform->find_child(table_name);
262 if (child !=
nullptr &&
263 child->
is_of_type(EggSAnimData::get_class_type())) {
277 _table->add_child(new_table);
278 CoordinateSystem cs = CS_default;
279 if (_xform !=
nullptr) {
280 cs = _xform->get_coordinate_system();
284 new_xform->
add_data(LMatrix4d::ident_mat());
294 _table->set_name(name);
virtual LMatrix4d get_frame(int n) const
Returns the transform matrix corresponding to this joint position in the nth frame.
bool add_data(const LMatrix4d &mat)
Adds a new matrix to the table, by adding a new row to each of the subtables.
virtual void set_frame(int n, const LMatrix4d &mat)
Sets the transform matrix corresponding to this joint position in the nth frame.
void quantize(double quantum)
Rounds each element of the table to the nearest multiple of quantum.
A base class for nodes in the hierarchy that are not leaf nodes.
virtual void extend_to(int num_frames)
Extends the table to the indicated number of frames.
Corresponding to an <S$Anim> entry, this stores a single column of numbers, for instance for a morph ...
virtual void zero_channels(const std::string &components)
Zeroes out the named components of the transform in the animation frames.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void optimize()
Resets the table before writing to disk so that redundant rows (e.g.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual EggJointPointer * make_new_joint(const std::string &name)
Creates a new child of the current joint in the egg data, and returns a pointer to it.
This class is used during joint optimization or restructuring to store the table of interim joint com...
virtual bool do_rebuild(EggCharacterDb &db)
Rebuilds the entire table all at once, based on the frames added by repeated calls to add_rebuild_fra...
virtual bool add_frame(const LMatrix4d &mat)
Appends a new frame onto the end of the data, if possible; returns true if not possible,...
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
This is a base class for EggJointNodePointer and EggMatrixTablePointer.
Corresponding to an <Xfm$Anim> entry, this stores a two-dimensional table with up to nine columns,...
virtual void set_name(const std::string &name)
Applies the indicated name change to the egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
EggNode * add_child(EggNode *node)
Adds the indicated child to the group and returns it.
This stores a pointer back to an EggXfmSAnim table (i.e.
virtual void quantize_channels(const std::string &components, double quantum)
Rounds the named components of the transform to the nearest multiple of quantum.
A base class for things that may be directly added into the egg hierarchy.
virtual int get_num_frames() const
Returns the number of frames of animation for this particular joint.
virtual void do_finish_reparent(EggJointPointer *new_parent)
Performs the actual reparenting operation by removing the node from its old parent and associating it...
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual double get_frame_rate() const
Returns the stated frame rate of this particular joint, or 0.0 if it doesn't state.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The highest-level base class in the egg directory.
bool get_matrix(const EggJointPointer *joint, TableType type, int frame, LMatrix4d &mat) const
Looks up the data for the indicated joint, type, and frame, and fills it in result (and returns true)...