Panda3D
|
00001 // Filename: characterSlider.cxx 00002 // Created by: drose (03Mar99) 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 #include "characterSlider.h" 00016 #include "characterVertexSlider.h" 00017 #include "datagram.h" 00018 #include "datagramIterator.h" 00019 #include "bamReader.h" 00020 #include "bamWriter.h" 00021 00022 TypeHandle CharacterSlider::_type_handle; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function: CharacterSlider::Default Constructor 00026 // Access: Protected 00027 // Description: For internal use only. 00028 //////////////////////////////////////////////////////////////////// 00029 CharacterSlider:: 00030 CharacterSlider() { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: CharacterSlider::Copy Constructor 00035 // Access: Protected 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 CharacterSlider:: 00039 CharacterSlider(const CharacterSlider ©) : 00040 MovingPartScalar(copy) 00041 { 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: CharacterSlider::Constructor 00046 // Access: Public 00047 // Description: 00048 //////////////////////////////////////////////////////////////////// 00049 CharacterSlider:: 00050 CharacterSlider(PartGroup *parent, const string &name) 00051 : MovingPartScalar(parent, name) { 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: CharacterSlider::Destructor 00056 // Access: Public, Virtual 00057 // Description: 00058 //////////////////////////////////////////////////////////////////// 00059 CharacterSlider:: 00060 ~CharacterSlider() { 00061 nassertv(_vertex_sliders.empty()); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: CharacterSlider::make_copy 00066 // Access: Public, Virtual 00067 // Description: Allocates and returns a new copy of the node. 00068 // Children are not copied, but see copy_subgraph(). 00069 //////////////////////////////////////////////////////////////////// 00070 PartGroup *CharacterSlider:: 00071 make_copy() const { 00072 return new CharacterSlider(*this); 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: CharacterSlider::update_internals 00077 // Access: Public, Virtual 00078 // Description: This is called by do_update() whenever the part or 00079 // some ancestor has changed values. It is a hook for 00080 // derived classes to update whatever cache they may 00081 // have that depends on these. 00082 // 00083 // The return value is true if the part has changed as a 00084 // result of the update, or false otherwise. 00085 //////////////////////////////////////////////////////////////////// 00086 bool CharacterSlider:: 00087 update_internals(PartBundle *, PartGroup *, bool, bool, Thread *current_thread) { 00088 // Tell our related CharacterVertexSliders that they now need to 00089 // recompute themselves. 00090 VertexSliders::iterator vsi; 00091 for (vsi = _vertex_sliders.begin(); vsi != _vertex_sliders.end(); ++vsi) { 00092 (*vsi)->mark_modified(current_thread); 00093 } 00094 00095 return true; 00096 } 00097 00098 //////////////////////////////////////////////////////////////////// 00099 // Function: CharacterSlider::make_CharacterSlider 00100 // Access: Protected 00101 // Description: Factory method to generate a CharacterSlider object 00102 //////////////////////////////////////////////////////////////////// 00103 TypedWritable* CharacterSlider:: 00104 make_CharacterSlider(const FactoryParams ¶ms) 00105 { 00106 CharacterSlider *me = new CharacterSlider; 00107 DatagramIterator scan; 00108 BamReader *manager; 00109 00110 parse_params(params, scan, manager); 00111 me->fillin(scan, manager); 00112 return me; 00113 } 00114 00115 //////////////////////////////////////////////////////////////////// 00116 // Function: CharacterSlider::register_with_factory 00117 // Access: Public, Static 00118 // Description: Factory method to generate a CharacterSlider object 00119 //////////////////////////////////////////////////////////////////// 00120 void CharacterSlider:: 00121 register_with_read_factory() 00122 { 00123 BamReader::get_factory()->register_factory(get_class_type(), make_CharacterSlider); 00124 } 00125 00126 00127 00128