00001 // Filename: eggCharacterData.I00002 // Created by: drose (23Feb01)00003 //00004 ////////////////////////////////////////////////////////////////////00005 //00006 // PANDA 3D SOFTWARE00007 // Copyright (c) Carnegie Mellon University. All rights reserved.00008 //00009 // All use of this software is subject to the terms of the revised BSD00010 // license. You should have received a copy of this license along00011 // with this source code in a file named "LICENSE."00012 //00013 ////////////////////////////////////////////////////////////////////00014
00015
00016
00017 ////////////////////////////////////////////////////////////////////00018 // Function: EggCharacterData::get_num_models00019 // Access: Public00020 // Description: Returns the total number of models associated with00021 // this character.00022 //00023 // A "model" here is either a character model (or one00024 // LOD of a character model), or a character animation00025 // file: in either case, a hierarchy of joints.00026 ////////////////////////////////////////////////////////////////////00027 INLINE intEggCharacterData::00028get_num_models() const {
00029 return _models.size();
00030 }
00031
00032 ////////////////////////////////////////////////////////////////////00033 // Function: EggCharacterData::get_model_index00034 // Access: Public00035 // Description: Returns the model_index of the nth model associated00036 // with this character. This model_index may be used to00037 // ask questions about the particular model from the00038 // EggCharacterCollection object, or from the individual00039 // EggJointData and EggSliderData objects.00040 //00041 // A "model" here is either a character model (or one00042 // LOD of a character model), or a character animation00043 // file: in either case, a hierarchy of joints.00044 ////////////////////////////////////////////////////////////////////00045 INLINE intEggCharacterData::00046get_model_index(int n) const {
00047 nassertr(n >= 0 && n < (int)_models.size(), 0);
00048 return _models[n]._model_index;
00049 }
00050
00051 ////////////////////////////////////////////////////////////////////00052 // Function: EggCharacterData::get_model_root00053 // Access: Public00054 // Description: Returns the model_root of the nth model associated00055 // with this character.00056 //00057 // This is the node at which the character, animation00058 // bundle, or LOD officially began within its particular00059 // egg file.00060 ////////////////////////////////////////////////////////////////////00061 INLINE EggNode *EggCharacterData::00062get_model_root(int n) const {
00063 nassertr(n >= 0 && n < (int)_models.size(), (EggNode *)NULL);
00064 return _models[n]._model_root;
00065 }
00066
00067 ////////////////////////////////////////////////////////////////////00068 // Function: EggCharacterData::get_egg_data00069 // Access: Public00070 // Description: Returns the EggData representing the egg file that00071 // defined this particular model. Note that one egg00072 // file might contain multiple models.00073 ////////////////////////////////////////////////////////////////////00074 INLINE EggData *EggCharacterData::00075get_egg_data(int n) const {
00076 nassertr(n >= 0 && n < (int)_models.size(), (EggData *)NULL);
00077 return _models[n]._egg_data;
00078 }
00079
00080 ////////////////////////////////////////////////////////////////////00081 // Function: EggCharacterData::get_root_joint00082 // Access: Public00083 // Description: Returns the root joint of the character hierarchy.00084 // This root joint does not represent an actual joint in00085 // the hierarchy, but instead is a fictitious joint that00086 // is the parent of all the top joints in the hierarchy00087 // (since the hierarchy may actually contain zero or00088 // more top joints).00089 ////////////////////////////////////////////////////////////////////00090 INLINE EggJointData *EggCharacterData::00091get_root_joint() const {
00092 return _root_joint;
00093 }
00094
00095 ////////////////////////////////////////////////////////////////////00096 // Function: EggCharacterData::find_joint00097 // Access: Public00098 // Description: Returns the first joint found with the indicated00099 // name, or NULL if no joint has that name.00100 ////////////////////////////////////////////////////////////////////00101 INLINE EggJointData *EggCharacterData::00102find_joint(conststring &name) const {
00103 return _root_joint->find_joint(name);
00104 }
00105
00106 ////////////////////////////////////////////////////////////////////00107 // Function: EggCharacterData::make_new_joint00108 // Access: Public00109 // Description: Creates a new joint as a child of the indicated joint00110 // and returns it. The new joint will be initialized to00111 // the identity transform, so that in inherits the00112 // net transform of the indicated parent joint.00113 ////////////////////////////////////////////////////////////////////00114 INLINE EggJointData *EggCharacterData::00115make_new_joint(conststring &name, EggJointData *parent) {
00116 EggJointData *joint = parent->make_new_joint(name);
00117 _joints.push_back(joint);
00118 _components.push_back(joint);
00119 return joint;
00120 }
00121
00122 ////////////////////////////////////////////////////////////////////00123 // Function: EggCharacterData::get_num_joints00124 // Access: Public00125 // Description: Returns the total number of joints in the character00126 // joint hierarchy.00127 ////////////////////////////////////////////////////////////////////00128 INLINE intEggCharacterData::00129get_num_joints() const {
00130 return _joints.size();
00131 }
00132
00133 ////////////////////////////////////////////////////////////////////00134 // Function: EggCharacterData::get_joint00135 // Access: Public00136 // Description: Returns the nth joint in the character joint00137 // hierarchy. This returns all of the joints in the00138 // hierarchy in an arbitrary ordering.00139 ////////////////////////////////////////////////////////////////////00140 INLINE EggJointData *EggCharacterData::00141get_joint(int n) const {
00142 nassertr(n >= 0 && n < (int)_joints.size(), NULL);
00143 return _joints[n];
00144 }
00145
00146 ////////////////////////////////////////////////////////////////////00147 // Function: EggCharacterData::get_num_sliders00148 // Access: Public00149 // Description: Returns the number of sliders in the character00150 // slider list.00151 ////////////////////////////////////////////////////////////////////00152 INLINE intEggCharacterData::00153get_num_sliders() const {
00154 return _sliders.size();
00155 }
00156
00157 ////////////////////////////////////////////////////////////////////00158 // Function: EggCharacterData::get_slider00159 // Access: Public00160 // Description: Returns the nth slider in the character slider list.00161 ////////////////////////////////////////////////////////////////////00162 INLINE EggSliderData *EggCharacterData::00163get_slider(int n) const {
00164 nassertr(n >= 0 && n < (int)_sliders.size(), NULL);
00165 return _sliders[n];
00166 }
00167
00168 ////////////////////////////////////////////////////////////////////00169 // Function: EggCharacterData::get_num_components00170 // Access: Public00171 // Description: Returns the total number of joints and sliders in00172 // the character.00173 ////////////////////////////////////////////////////////////////////00174 INLINE intEggCharacterData::00175get_num_components() const {
00176 return _components.size();
00177 }
00178
00179 ////////////////////////////////////////////////////////////////////00180 // Function: EggCharacterData::get_component00181 // Access: Public00182 // Description: Returns the nth joint or slider in the character.00183 // This can be used to walk linearly through all joints00184 // and sliders in the character when you don't care00185 // about making a distinction between the two; it00186 // returns the same objects that can also be discovered00187 // via get_slider() and get_root_joint().00188 ////////////////////////////////////////////////////////////////////00189 INLINE EggComponentData *EggCharacterData::00190get_component(int n) const {
00191 nassertr(n >= 0 && n < (int)_components.size(), NULL);
00192 return _components[n];
00193 }