Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/eggcharbase/eggComponentData.cxx

Go to the documentation of this file.
00001 // Filename: eggComponentData.cxx
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 #include "eggComponentData.h"
00020 #include "eggBackPointer.h"
00021 
00022 #include "indent.h"
00023 
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: EggComponentData::Constructor
00027 //       Access: Public
00028 //  Description:
00029 ////////////////////////////////////////////////////////////////////
00030 EggComponentData::
00031 EggComponentData(EggCharacterCollection *collection,
00032                  EggCharacterData *char_data) :
00033   _collection(collection),
00034   _char_data(char_data)
00035 {
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: EggComponentData::Destructor
00040 //       Access: Public, Virtual
00041 //  Description:
00042 ////////////////////////////////////////////////////////////////////
00043 EggComponentData::
00044 ~EggComponentData() {
00045   BackPointers::iterator bpi;
00046   for (bpi = _back_pointers.begin(); bpi != _back_pointers.end(); ++bpi) {
00047     EggBackPointer *back = (*bpi);
00048     if (back != (EggBackPointer *)NULL) {
00049       delete back;
00050     }
00051   }
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: EggComponentData::add_name
00056 //       Access: Public
00057 //  Description: Adds the indicated name to the set of names that this
00058 //               component can be identified with.  If this is the
00059 //               first name added, it becomes the primary name of the
00060 //               component; later names added do not replace the
00061 //               primary name, but do get added to the list of names
00062 //               that will be accepted by matched_name().
00063 ////////////////////////////////////////////////////////////////////
00064 void EggComponentData::
00065 add_name(const string &name) {
00066   if (!has_name()) {
00067     set_name(name);
00068   }
00069 }
00070 
00071 ////////////////////////////////////////////////////////////////////
00072 //     Function: EggComponentData::matches_name
00073 //       Access: Public
00074 //  Description: Returns true if the indicated name matches any name
00075 //               that was ever matched with this particular joint,
00076 //               false otherwise.
00077 ////////////////////////////////////////////////////////////////////
00078 bool EggComponentData::
00079 matches_name(const string &name) const {
00080   return false;
00081 }
00082 
00083 ////////////////////////////////////////////////////////////////////
00084 //     Function: EggComponentData::set_model
00085 //       Access: Public
00086 //  Description: Sets the back_pointer associated with the given
00087 //               model_index.
00088 ////////////////////////////////////////////////////////////////////
00089 void EggComponentData::
00090 set_model(int model_index, EggBackPointer *back) {
00091   while ((int)_back_pointers.size() <= model_index) {
00092     _back_pointers.push_back((EggBackPointer *)NULL);
00093   }
00094 
00095   if (_back_pointers[model_index] != (EggBackPointer *)NULL) {
00096     nout << "Warning: deleting old back pointer.\n";
00097     delete _back_pointers[model_index];
00098   }
00099   _back_pointers[model_index] = back;
00100 }

Generated on Fri May 2 03:18:42 2003 for Panda-Tool by doxygen1.3