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