Panda3D
eggJointData.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggJointData.I
10  * @author drose
11  * @date 2001-02-23
12  */
13 
14 /**
15  *
16  */
17 INLINE EggJointData *EggJointData::
18 get_parent() const {
19  return _parent;
20 }
21 
22 /**
23  *
24  */
25 INLINE int EggJointData::
26 get_num_children() const {
27  return _children.size();
28 }
29 
30 /**
31  *
32  */
33 INLINE EggJointData *EggJointData::
34 get_child(int n) const {
35  nassertr(n >= 0 && n < (int)_children.size(), nullptr);
36  return _children[n];
37 }
38 
39 /**
40  * Returns the first descendent joint found with the indicated name, or NULL
41  * if no joint has that name.
42  */
44 find_joint(const std::string &name) {
45  EggJointData *joint = find_joint_exact(name);
46  if (joint == nullptr) {
47  joint = find_joint_matches(name);
48  }
49  return joint;
50 }
51 
52 
53 /**
54  * Returns true if the joint knows its rest frame, false otherwise. In
55  * general, this will be true as long as the joint is included in at least one
56  * model file, or false if it appears only in animation files.
57  */
58 INLINE bool EggJointData::
59 has_rest_frame() const {
60  return _has_rest_frame;
61 }
62 
63 /**
64  * Returns true if the rest frames for different models differ in their
65  * initial value. This is not technically an error, but it is unusual enough
66  * to be suspicious.
67  */
68 INLINE bool EggJointData::
70  return _rest_frames_differ;
71 }
72 
73 /**
74  * Returns the rest frame of the joint. This is the matrix value that appears
75  * for the joint in each model file; it should be the same transform in each
76  * model.
77  */
78 INLINE const LMatrix4d &EggJointData::
79 get_rest_frame() const {
80  nassertr(has_rest_frame(), LMatrix4d::ident_mat());
81  return _rest_frame;
82 }
83 
84 /**
85  * Indicates an intention to change the parent of this joint to the indicated
86  * joint, or NULL to remove it from the hierarchy. The joint is not
87  * reparented immediately, but rather all of the joints are reparented at once
88  * when do_reparent() is called.
89  */
90 INLINE void EggJointData::
91 reparent_to(EggJointData *new_parent) {
92  _new_parent = new_parent;
93 }
void reparent_to(EggJointData *new_parent)
Indicates an intention to change the parent of this joint to the indicated joint, or NULL to remove i...
Definition: eggJointData.I:91
bool rest_frames_differ() const
Returns true if the rest frames for different models differ in their initial value.
Definition: eggJointData.I:69
bool has_rest_frame() const
Returns true if the joint knows its rest frame, false otherwise.
Definition: eggJointData.I:59
const LMatrix4d & get_rest_frame() const
Returns the rest frame of the joint.
Definition: eggJointData.I:79
This is one node of a hierarchy of EggJointData nodes, each of which represents a single joint of the...
Definition: eggJointData.h:31
EggJointData * find_joint(const std::string &name)
Returns the first descendent joint found with the indicated name, or NULL if no joint has that name.
Definition: eggJointData.I:44