00001 // Filename: somethingToEggConverter.I00002 // Created by: drose (26Apr01)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 // Function: SomethingToEggConverter::clear_error00018 // Access: Public00019 // Description: Resets the error flag to the no-error state.00020 // had_error() will return false until a new error is00021 // generated.00022 ////////////////////////////////////////////////////////////////////00023 INLINE voidSomethingToEggConverter::00024clear_error() {
00025 _error = false;
00026 }
00027
00028 ////////////////////////////////////////////////////////////////////00029 // Function: SomethingToEggConverter::had_error00030 // Access: Public00031 // Description: Returns true if an error was detected during the00032 // conversion process (unless _allow_errors is true),00033 // false otherwise.00034 ////////////////////////////////////////////////////////////////////00035 INLINE boolSomethingToEggConverter::00036had_error() const {
00037 return !_allow_errors && (_error || _path_replace->had_error());
00038 }
00039
00040 ////////////////////////////////////////////////////////////////////00041 // Function: SomethingToEggConverter::set_path_replace00042 // Access: Public00043 // Description: Replaces the PathReplace object (which specifies how00044 // to mangle paths from the source to the destination00045 // egg file) with a new one.00046 ////////////////////////////////////////////////////////////////////00047 INLINE voidSomethingToEggConverter::00048set_path_replace(PathReplace *path_replace) {
00049 _path_replace = path_replace;
00050 }
00051
00052 ////////////////////////////////////////////////////////////////////00053 // Function: SomethingToEggConverter::get_path_replace00054 // Access: Public00055 // Description: Returns a pointer to the PathReplace object00056 // associated with this converter. If the converter is00057 // non-const, this returns a non-const pointer, which00058 // can be adjusted.00059 ////////////////////////////////////////////////////////////////////00060 INLINE PathReplace *SomethingToEggConverter::00061get_path_replace() {
00062 return _path_replace;
00063 }
00064
00065 ////////////////////////////////////////////////////////////////////00066 // Function: SomethingToEggConverter::get_path_replace00067 // Access: Public00068 // Description: Returns a pointer to the PathReplace object00069 // associated with this converter. If the converter is00070 // non-const, this returns a non-const pointer, which00071 // can be adjusted.00072 ////////////////////////////////////////////////////////////////////00073 INLINE constPathReplace *SomethingToEggConverter::00074get_path_replace() const {
00075 return _path_replace;
00076 }
00077
00078 ////////////////////////////////////////////////////////////////////00079 // Function: SomethingToEggConverter::set_animation_convert00080 // Access: Public00081 // Description: Specifies how source animation will be converted into00082 // egg structures. The default is AC_none, which means00083 // animation tables will be ignored. This is only00084 // meaningful for converters that understand animation.00085 ////////////////////////////////////////////////////////////////////00086 INLINE voidSomethingToEggConverter::00087set_animation_convert(AnimationConvert animation_convert) {
00088 _animation_convert = animation_convert;
00089 }
00090
00091 ////////////////////////////////////////////////////////////////////00092 // Function: SomethingToEggConverter::get_animation_convert00093 // Access: Public00094 // Description: Returns how source animation will be converted into00095 // egg structures.00096 ////////////////////////////////////////////////////////////////////00097 INLINE AnimationConvert SomethingToEggConverter::00098get_animation_convert() const {
00099 return _animation_convert;
00100 }
00101
00102 ////////////////////////////////////////////////////////////////////00103 // Function: SomethingToEggConverter::set_character_name00104 // Access: Public00105 // Description: Specifies the name of the character generated. This00106 // name should match between all the model and channel00107 // egg files for a particular character and its00108 // associated animations.00109 ////////////////////////////////////////////////////////////////////00110 INLINE voidSomethingToEggConverter::00111set_character_name(conststring &character_name) {
00112 _character_name = character_name;
00113 }
00114
00115 ////////////////////////////////////////////////////////////////////00116 // Function: SomethingToEggConverter::get_character_name00117 // Access: Public00118 // Description: Returns the name of the character generated. See00119 // set_character_name().00120 ////////////////////////////////////////////////////////////////////00121 INLINE conststring &SomethingToEggConverter::00122get_character_name() const {
00123 return _character_name;
00124 }
00125
00126 ////////////////////////////////////////////////////////////////////00127 // Function: SomethingToEggConverter::set_start_frame00128 // Access: Public00129 // Description: Specifies the starting frame of the animation to00130 // convert, in the units specified by00131 // set_input_frame_rate(). If this is unspecified, the00132 // starting frame is taken from the source, for instance00133 // from the first frame of the animation slider.00134 ////////////////////////////////////////////////////////////////////00135 INLINE voidSomethingToEggConverter::00136set_start_frame(double start_frame) {
00137 _start_frame = start_frame;
00138 _control_flags |= CF_start_frame;
00139 }
00140
00141 ////////////////////////////////////////////////////////////////////00142 // Function: SomethingToEggConverter::has_start_frame00143 // Access: Public00144 // Description: Returns true if the starting frame has been00145 // explicitly specified via set_start_frame(), or false00146 // if the starting frame should be implicit based on the00147 // source.00148 ////////////////////////////////////////////////////////////////////00149 INLINE boolSomethingToEggConverter::00150has_start_frame() const {
00151 return (_control_flags & CF_start_frame) != 0;
00152 }
00153
00154 ////////////////////////////////////////////////////////////////////00155 // Function: SomethingToEggConverter::get_start_frame00156 // Access: Public00157 // Description: Returns the value set by a previous call to00158 // set_start_frame(). It is an error to call this if00159 // has_start_frame() returns false.00160 ////////////////////////////////////////////////////////////////////00161 INLINE doubleSomethingToEggConverter::00162get_start_frame() const {
00163 nassertr(has_start_frame(), 0.0);
00164 return _start_frame;
00165 }
00166
00167 ////////////////////////////////////////////////////////////////////00168 // Function: SomethingToEggConverter::clear_start_frame00169 // Access: Public00170 // Description: Removes the value previously set by00171 // set_start_frame().00172 ////////////////////////////////////////////////////////////////////00173 INLINE voidSomethingToEggConverter::00174clear_start_frame() {
00175 _start_frame = 0.0;
00176 _control_flags &= ~CF_start_frame;
00177 }
00178
00179 ////////////////////////////////////////////////////////////////////00180 // Function: SomethingToEggConverter::set_end_frame00181 // Access: Public00182 // Description: Specifies the ending frame of the animation to00183 // convert, in the units specified by00184 // set_input_frame_rate(). If this is unspecified, the00185 // ending frame is taken from the source, for instance00186 // from the last frame of the animation slider.00187 ////////////////////////////////////////////////////////////////////00188 INLINE voidSomethingToEggConverter::00189set_end_frame(double end_frame) {
00190 _end_frame = end_frame;
00191 _control_flags |= CF_end_frame;
00192 }
00193
00194 ////////////////////////////////////////////////////////////////////00195 // Function: SomethingToEggConverter::has_end_frame00196 // Access: Public00197 // Description: Returns true if the ending frame has been00198 // explicitly specified via set_end_frame(), or false00199 // if the ending frame should be implicit based on the00200 // source.00201 ////////////////////////////////////////////////////////////////////00202 INLINE boolSomethingToEggConverter::00203has_end_frame() const {
00204 return (_control_flags & CF_end_frame) != 0;
00205 }
00206
00207 ////////////////////////////////////////////////////////////////////00208 // Function: SomethingToEggConverter::get_end_frame00209 // Access: Public00210 // Description: Returns the value set by a previous call to00211 // set_end_frame(). It is an error to call this if00212 // has_end_frame() returns false.00213 ////////////////////////////////////////////////////////////////////00214 INLINE doubleSomethingToEggConverter::00215get_end_frame() const {
00216 nassertr(has_end_frame(), 0.0);
00217 return _end_frame;
00218 }
00219
00220 ////////////////////////////////////////////////////////////////////00221 // Function: SomethingToEggConverter::clear_end_frame00222 // Access: Public00223 // Description: Removes the value previously set by00224 // set_end_frame().00225 ////////////////////////////////////////////////////////////////////00226 INLINE voidSomethingToEggConverter::00227clear_end_frame() {
00228 _end_frame = 0.0;
00229 _control_flags &= ~CF_end_frame;
00230 }
00231
00232 ////////////////////////////////////////////////////////////////////00233 // Function: SomethingToEggConverter::set_frame_inc00234 // Access: Public00235 // Description: Specifies the increment between frames to extract.00236 // This is the amount to increment the time slider (in00237 // units of internal_frame_rate) between extracting each00238 // frame. If this is not specified, the default is00239 // taken from the animation package, or 1.0 if the00240 // animation package does not specified a frame00241 // increment.00242 ////////////////////////////////////////////////////////////////////00243 INLINE voidSomethingToEggConverter::00244set_frame_inc(double frame_inc) {
00245 _frame_inc = frame_inc;
00246 _control_flags |= CF_frame_inc;
00247 }
00248
00249 ////////////////////////////////////////////////////////////////////00250 // Function: SomethingToEggConverter::has_frame_inc00251 // Access: Public00252 // Description: Returns true if the frame increment has been00253 // explicitly specified via set_frame_inc(), or false00254 // if the ending frame should be implicit based on the00255 // source.00256 ////////////////////////////////////////////////////////////////////00257 INLINE boolSomethingToEggConverter::00258has_frame_inc() const {
00259 return (_control_flags & CF_frame_inc) != 0;
00260 }
00261
00262 ////////////////////////////////////////////////////////////////////00263 // Function: SomethingToEggConverter::get_frame_inc00264 // Access: Public00265 // Description: Returns the value set by a previous call to00266 // set_frame_inc(). It is an error to call this if00267 // has_frame_inc() returns false.00268 ////////////////////////////////////////////////////////////////////00269 INLINE doubleSomethingToEggConverter::00270get_frame_inc() const {
00271 nassertr(has_frame_inc(), 0.0);
00272 return _frame_inc;
00273 }
00274
00275 ////////////////////////////////////////////////////////////////////00276 // Function: SomethingToEggConverter::clear_frame_inc00277 // Access: Public00278 // Description: Removes the value previously set by00279 // set_frame_inc().00280 ////////////////////////////////////////////////////////////////////00281 INLINE voidSomethingToEggConverter::00282clear_frame_inc() {
00283 _frame_inc = 0.0;
00284 _control_flags &= ~CF_frame_inc;
00285 }
00286
00287 ////////////////////////////////////////////////////////////////////00288 // Function: SomethingToEggConverter::set_neutral_frame00289 // Access: Public00290 // Description: Specifies the frame of animation to represent the00291 // neutral pose of the model.00292 ////////////////////////////////////////////////////////////////////00293 INLINE voidSomethingToEggConverter::00294set_neutral_frame(double neutral_frame) {
00295 _neutral_frame = neutral_frame;
00296 _control_flags |= CF_neutral_frame;
00297 }
00298
00299 ////////////////////////////////////////////////////////////////////00300 // Function: SomethingToEggConverter::has_neutral_frame00301 // Access: Public00302 // Description: Returns true if the neutral frame has been00303 // explicitly specified via set_neutral_frame(), or00304 // false otherwise.00305 ////////////////////////////////////////////////////////////////////00306 INLINE boolSomethingToEggConverter::00307has_neutral_frame() const {
00308 return (_control_flags & CF_neutral_frame) != 0;
00309 }
00310
00311 ////////////////////////////////////////////////////////////////////00312 // Function: SomethingToEggConverter::get_neutral_frame00313 // Access: Public00314 // Description: Returns the value set by a previous call to00315 // set_neutral_frame(). It is an error to call this if00316 // has_neutral_frame() returns false.00317 ////////////////////////////////////////////////////////////////////00318 INLINE doubleSomethingToEggConverter::00319get_neutral_frame() const {
00320 nassertr(has_neutral_frame(), 0.0);
00321 return _neutral_frame;
00322 }
00323
00324 ////////////////////////////////////////////////////////////////////00325 // Function: SomethingToEggConverter::clear_neutral_frame00326 // Access: Public00327 // Description: Removes the value previously set by00328 // set_neutral_frame().00329 ////////////////////////////////////////////////////////////////////00330 INLINE voidSomethingToEggConverter::00331clear_neutral_frame() {
00332 _neutral_frame = 0.0;
00333 _control_flags &= ~CF_neutral_frame;
00334 }
00335
00336 ////////////////////////////////////////////////////////////////////00337 // Function: SomethingToEggConverter::set_input_frame_rate00338 // Access: Public00339 // Description: Specifies the number of frames per second that is00340 // represented by the "frame" unit in the animation00341 // package. If this is omitted, it is taken from00342 // whatever the file header indicates. Some animation00343 // packages do not encode a frame rate, in which case00344 // the default if this is omitted is the same as the00345 // output frame rate.00346 ////////////////////////////////////////////////////////////////////00347 INLINE voidSomethingToEggConverter::00348set_input_frame_rate(double input_frame_rate) {
00349 _input_frame_rate = input_frame_rate;
00350 _control_flags |= CF_input_frame_rate;
00351 }
00352
00353 ////////////////////////////////////////////////////////////////////00354 // Function: SomethingToEggConverter::has_input_frame_rate00355 // Access: Public00356 // Description: Returns true if the frame rate has been00357 // explicitly specified via set_input_frame_rate(), or00358 // false otherwise.00359 ////////////////////////////////////////////////////////////////////00360 INLINE boolSomethingToEggConverter::00361has_input_frame_rate() const {
00362 return (_control_flags & CF_input_frame_rate) != 0;
00363 }
00364
00365 ////////////////////////////////////////////////////////////////////00366 // Function: SomethingToEggConverter::get_input_frame_rate00367 // Access: Public00368 // Description: Returns the value set by a previous call to00369 // set_input_frame_rate(). It is an error to call this00370 // if has_input_frame_rate() returns false.00371 ////////////////////////////////////////////////////////////////////00372 INLINE doubleSomethingToEggConverter::00373get_input_frame_rate() const {
00374 nassertr(has_input_frame_rate(), 0.0);
00375 return _input_frame_rate;
00376 }
00377
00378 ////////////////////////////////////////////////////////////////////00379 // Function: SomethingToEggConverter::clear_input_frame_rate00380 // Access: Public00381 // Description: Removes the value previously set by00382 // set_input_frame_rate().00383 ////////////////////////////////////////////////////////////////////00384 INLINE voidSomethingToEggConverter::00385clear_input_frame_rate() {
00386 _input_frame_rate = 0.0;
00387 _control_flags &= ~CF_input_frame_rate;
00388 }
00389
00390 ////////////////////////////////////////////////////////////////////00391 // Function: SomethingToEggConverter::set_output_frame_rate00392 // Access: Public00393 // Description: Specifies the number of frames per second that the00394 // resulting animation should be played at. If this is00395 // omitted, it is taken to be the same as the input00396 // frame rate.00397 ////////////////////////////////////////////////////////////////////00398 INLINE voidSomethingToEggConverter::00399set_output_frame_rate(double output_frame_rate) {
00400 _output_frame_rate = output_frame_rate;
00401 _control_flags |= CF_output_frame_rate;
00402 }
00403
00404 ////////////////////////////////////////////////////////////////////00405 // Function: SomethingToEggConverter::has_output_frame_rate00406 // Access: Public00407 // Description: Returns true if the frame rate has been00408 // explicitly specified via set_output_frame_rate(), or00409 // false otherwise.00410 ////////////////////////////////////////////////////////////////////00411 INLINE boolSomethingToEggConverter::00412has_output_frame_rate() const {
00413 return (_control_flags & CF_output_frame_rate) != 0;
00414 }
00415
00416 ////////////////////////////////////////////////////////////////////00417 // Function: SomethingToEggConverter::get_output_frame_rate00418 // Access: Public00419 // Description: Returns the value set by a previous call to00420 // set_output_frame_rate(). It is an error to call this00421 // if has_output_frame_rate() returns false.00422 ////////////////////////////////////////////////////////////////////00423 INLINE doubleSomethingToEggConverter::00424get_output_frame_rate() const {
00425 nassertr(has_output_frame_rate(), 0.0);
00426 return _output_frame_rate;
00427 }
00428
00429 ////////////////////////////////////////////////////////////////////00430 // Function: SomethingToEggConverter::clear_output_frame_rate00431 // Access: Public00432 // Description: Removes the value previously set by00433 // set_output_frame_rate().00434 ////////////////////////////////////////////////////////////////////00435 INLINE voidSomethingToEggConverter::00436clear_output_frame_rate() {
00437 _output_frame_rate = 0.0;
00438 _control_flags &= ~CF_output_frame_rate;
00439 }
00440
00441 ////////////////////////////////////////////////////////////////////00442 // Function: SomethingToEggConverter::get_default_frame_rate00443 // Access: Public, Static00444 // Description: Returns the default frame rate if nothing is00445 // specified for input_frame_rate or output_frame_rate,00446 // and the animation package does not have an implicit00447 // frame rate.00448 ////////////////////////////////////////////////////////////////////00449 INLINE doubleSomethingToEggConverter::00450get_default_frame_rate() {
00451 return 24.0;
00452 }
00453
00454 ////////////////////////////////////////////////////////////////////00455 // Function: SomethingToEggConverter::set_merge_externals00456 // Access: Public00457 // Description: Sets the merge_externals flag. When this is true,00458 // external references within the source file are read00459 // in and merged directly; otherwise, only a reference00460 // to a similarly-named egg file is inserted.00461 ////////////////////////////////////////////////////////////////////00462 INLINE voidSomethingToEggConverter::00463set_merge_externals(bool merge_externals) {
00464 _merge_externals = merge_externals;
00465 }
00466
00467 ////////////////////////////////////////////////////////////////////00468 // Function: SomethingToEggConverter::get_merge_externals00469 // Access: Public00470 // Description: Returns the current state of the merge_externals00471 // flag. See set_merge_externals().00472 ////////////////////////////////////////////////////////////////////00473 INLINE boolSomethingToEggConverter::00474get_merge_externals() const {
00475 return _merge_externals;
00476 }
00477
00478 ////////////////////////////////////////////////////////////////////00479 // Function: SomethingToEggConverter::clear_egg_data00480 // Access: Public00481 // Description: Sets the EggData to NULL and makes the converter00482 // invalid.00483 ////////////////////////////////////////////////////////////////////00484 INLINE voidSomethingToEggConverter::00485clear_egg_data() {
00486 set_egg_data((EggData *)NULL);
00487 }
00488
00489 ////////////////////////////////////////////////////////////////////00490 // Function: SomethingToEggConverter::get_egg_data00491 // Access: Public00492 // Description: Returns the EggData structure.00493 ////////////////////////////////////////////////////////////////////00494 INLINE EggData *SomethingToEggConverter::00495get_egg_data() {
00496 return _egg_data;
00497 }
00498
00499 ////////////////////////////////////////////////////////////////////00500 // Function: SomethingToEggConverter::convert_model_path00501 // Access: Public00502 // Description: Converts the indicated model filename to a relative00503 // or absolute or whatever filename, according to00504 // _path_replace.00505 ////////////////////////////////////////////////////////////////////00506 INLINE FilenameSomethingToEggConverter::00507convert_model_path(constFilename &orig_filename) {
00508 return _path_replace->convert_path(orig_filename);
00509 }