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

pandatool/src/eggcharbase/eggSliderData.cxx

Go to the documentation of this file.
00001 // Filename: eggSliderData.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 "eggSliderData.h"
00020 #include "eggVertexPointer.h"
00021 
00022 #include <eggPrimitive.h>
00023 #include <eggVertex.h>
00024 #include <eggSAnimData.h>
00025 #include <indent.h>
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //     Function: EggSliderData::Constructor
00029 //       Access: Public
00030 //  Description:
00031 ////////////////////////////////////////////////////////////////////
00032 EggSliderData::
00033 EggSliderData(EggCharacterCollection *collection,
00034               EggCharacterData *char_data) :
00035   EggComponentData(collection, char_data)
00036 {
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: EggSliderData::add_back_pointer
00041 //       Access: Public, Virtual
00042 //  Description: Adds the indicated vertex, primitive, or morph table
00043 //               to the data.
00044 ////////////////////////////////////////////////////////////////////
00045 void EggSliderData::
00046 add_back_pointer(int model_index, EggObject *egg_object) {
00047   if (egg_object->is_of_type(EggPrimitive::get_class_type())) {
00048     // A primitive!
00049     EggBackPointer *back = get_model(model_index);
00050     if (back == (EggBackPointer *)NULL) {
00051       back = new EggVertexPointer;
00052       set_model(model_index, back);
00053     }
00054 
00055   } else if (egg_object->is_of_type(EggVertex::get_class_type())) {
00056     // A vertex!
00057     EggBackPointer *back = get_model(model_index);
00058     if (back == (EggBackPointer *)NULL) {
00059       back = new EggVertexPointer;
00060       set_model(model_index, back);
00061     }
00062 
00063   } else if (egg_object->is_of_type(EggSAnimData::get_class_type())) {
00064     // A slider animation table!  Woo hoo!
00065     EggBackPointer *back = get_model(model_index);
00066     if (back == (EggBackPointer *)NULL) {
00067       back = new EggVertexPointer;
00068       set_model(model_index, back);
00069     }
00070 
00071   } else {
00072     nout << "Invalid object added to slider for back pointer.\n";
00073   }
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: EggSliderData::write
00078 //       Access: Public, Virtual
00079 //  Description:
00080 ////////////////////////////////////////////////////////////////////
00081 void EggSliderData::
00082 write(ostream &out, int indent_level) const {
00083   indent(out, indent_level)
00084     << "Slider " << get_name()
00085     << " (models:";
00086   int num_models = get_num_models();
00087   for (int model_index = 0; model_index < num_models; model_index++) {
00088     if (has_model(model_index)) {
00089       out << " " << model_index;
00090     }
00091   }
00092   out << ")\n";
00093 }

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