00001 // Filename: eggComponentData.h 00002 // Created by: drose (26Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef EGGCOMPONENTDATA_H 00020 #define EGGCOMPONENTDATA_H 00021 00022 #include "pandatoolbase.h" 00023 00024 #include "namable.h" 00025 00026 class EggCharacterCollection; 00027 class EggCharacterData; 00028 class EggBackPointer; 00029 class EggObject; 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Class : EggComponentData 00033 // Description : This is the base class of both EggJointData and 00034 // EggSliderData. It represents a single component of a 00035 // character, either a joint or a slider, along with 00036 // back pointers to the references to this component in 00037 // all model and animation egg files read. 00038 //////////////////////////////////////////////////////////////////// 00039 class EggComponentData : public Namable { 00040 public: 00041 EggComponentData(EggCharacterCollection *collection, 00042 EggCharacterData *char_data); 00043 virtual ~EggComponentData(); 00044 00045 void add_name(const string &name); 00046 bool matches_name(const string &name) const; 00047 00048 virtual void add_back_pointer(int model_index, EggObject *egg_object)=0; 00049 virtual void write(ostream &out, int indent_level = 0) const=0; 00050 00051 INLINE int get_num_models() const; 00052 INLINE bool has_model(int model_index) const; 00053 INLINE EggBackPointer *get_model(int model_index) const; 00054 void set_model(int model_index, EggBackPointer *back); 00055 00056 protected: 00057 00058 // This points back to all the egg structures that reference this 00059 // particular table or slider. 00060 typedef pvector<EggBackPointer *> BackPointers; 00061 BackPointers _back_pointers; 00062 00063 00064 EggCharacterCollection *_collection; 00065 EggCharacterData *_char_data; 00066 }; 00067 00068 #include "eggComponentData.I" 00069 00070 #endif 00071 00072