00001 // Filename: eggJointData.I 00002 // Created by: drose (23Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: EggJointData::get_parent 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE EggJointData *EggJointData:: 00022 get_parent() const { 00023 return _parent; 00024 } 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Function: EggJointData::get_num_children 00028 // Access: Public 00029 // Description: 00030 //////////////////////////////////////////////////////////////////// 00031 INLINE int EggJointData:: 00032 get_num_children() const { 00033 return _children.size(); 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: EggJointData::get_child 00038 // Access: Public 00039 // Description: 00040 //////////////////////////////////////////////////////////////////// 00041 INLINE EggJointData *EggJointData:: 00042 get_child(int n) const { 00043 nassertr(n >= 0 && n < (int)_children.size(), (EggJointData *)NULL); 00044 return _children[n]; 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: EggJointData::find_joint 00049 // Access: Public 00050 // Description: Returns the first descendent joint found with the 00051 // indicated name, or NULL if no joint has that name. 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE EggJointData *EggJointData:: 00054 find_joint(const string &name) { 00055 EggJointData *joint = find_joint_exact(name); 00056 if (joint == (EggJointData *)NULL) { 00057 joint = find_joint_matches(name); 00058 } 00059 return joint; 00060 } 00061 00062 00063 //////////////////////////////////////////////////////////////////// 00064 // Function: EggJointData::has_rest_frame 00065 // Access: Public 00066 // Description: Returns true if the joint knows its rest frame, false 00067 // otherwise. In general, this will be true as long as 00068 // the joint is included in at least one model file, or 00069 // false if it appears only in animation files. 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE bool EggJointData:: 00072 has_rest_frame() const { 00073 return _has_rest_frame; 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: EggJointData::rest_frames_differ 00078 // Access: Public 00079 // Description: Returns true if the rest frames for different models 00080 // differ in their initial value. This is not 00081 // technically an error, but it is unusual enough to be 00082 // suspicious. 00083 //////////////////////////////////////////////////////////////////// 00084 INLINE bool EggJointData:: 00085 rest_frames_differ() const { 00086 return _rest_frames_differ; 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: EggJointData::get_rest_frame 00091 // Access: Public 00092 // Description: Returns the rest frame of the joint. This is the 00093 // matrix value that appears for the joint in each model 00094 // file; it should be the same transform in each model. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE const LMatrix4d &EggJointData:: 00097 get_rest_frame() const { 00098 nassertr(has_rest_frame(), LMatrix4d::ident_mat()); 00099 return _rest_frame; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: EggJointData::reparent_to 00104 // Access: Public 00105 // Description: Indicates an intention to change the parent of this 00106 // joint to the indicated joint, or NULL to remove it 00107 // from the hierarchy. The joint is not reparented 00108 // immediately, but rather all of the joints are 00109 // reparented at once when do_reparent() is called. 00110 //////////////////////////////////////////////////////////////////// 00111 INLINE void EggJointData:: 00112 reparent_to(EggJointData *new_parent) { 00113 _new_parent = new_parent; 00114 }