00001 // Filename: eggComponentData.I 00002 // Created by: drose (26Feb01) 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: EggComponentData::get_num_models 00018 // Access: Public 00019 // Description: Returns the maximum number of back pointers this 00020 // component may have. The component may store a back 00021 // pointer for models indexed 0 .. num_models - 00022 // 1. You must call has_model() on each model 00023 // index to confirm whether a particular model in that 00024 // range has a back pointer. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE int EggComponentData:: 00027 get_num_models() const { 00028 return _back_pointers.size(); 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: EggComponentData::has_model 00033 // Access: Public 00034 // Description: Returns true if the component has a back pointer to 00035 // an egg file somewhere for the indicated model, false 00036 // otherwise. 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE bool EggComponentData:: 00039 has_model(int model_index) const { 00040 if (model_index >= 0 && model_index < (int)_back_pointers.size()) { 00041 return _back_pointers[model_index] != (EggBackPointer *)NULL; 00042 } 00043 return false; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: EggComponentData::get_model 00048 // Access: Public 00049 // Description: Returns the back pointer to an egg file for the 00050 // indicated model if it exists, or NULL if it does not. 00051 //////////////////////////////////////////////////////////////////// 00052 INLINE EggBackPointer *EggComponentData:: 00053 get_model(int model_index) const { 00054 if (model_index >= 0 && model_index < (int)_back_pointers.size()) { 00055 return _back_pointers[model_index]; 00056 } 00057 return (EggBackPointer *)NULL; 00058 }