Panda3D
 All Classes Functions Variables Enumerations
characterSlider.cxx
1 // Filename: characterSlider.cxx
2 // Created by: drose (03Mar99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "characterSlider.h"
16 #include "characterVertexSlider.h"
17 #include "datagram.h"
18 #include "datagramIterator.h"
19 #include "bamReader.h"
20 #include "bamWriter.h"
21 
22 TypeHandle CharacterSlider::_type_handle;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function: CharacterSlider::Default Constructor
26 // Access: Protected
27 // Description: For internal use only.
28 ////////////////////////////////////////////////////////////////////
29 CharacterSlider::
30 CharacterSlider() {
31 }
32 
33 ////////////////////////////////////////////////////////////////////
34 // Function: CharacterSlider::Copy Constructor
35 // Access: Protected
36 // Description:
37 ////////////////////////////////////////////////////////////////////
38 CharacterSlider::
39 CharacterSlider(const CharacterSlider &copy) :
40  MovingPartScalar(copy)
41 {
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: CharacterSlider::Constructor
46 // Access: Public
47 // Description:
48 ////////////////////////////////////////////////////////////////////
49 CharacterSlider::
50 CharacterSlider(PartGroup *parent, const string &name)
51  : MovingPartScalar(parent, name) {
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: CharacterSlider::Destructor
56 // Access: Public, Virtual
57 // Description:
58 ////////////////////////////////////////////////////////////////////
59 CharacterSlider::
60 ~CharacterSlider() {
61  nassertv(_vertex_sliders.empty());
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: CharacterSlider::make_copy
66 // Access: Public, Virtual
67 // Description: Allocates and returns a new copy of the node.
68 // Children are not copied, but see copy_subgraph().
69 ////////////////////////////////////////////////////////////////////
71 make_copy() const {
72  return new CharacterSlider(*this);
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: CharacterSlider::update_internals
77 // Access: Public, Virtual
78 // Description: This is called by do_update() whenever the part or
79 // some ancestor has changed values. It is a hook for
80 // derived classes to update whatever cache they may
81 // have that depends on these.
82 //
83 // The return value is true if the part has changed as a
84 // result of the update, or false otherwise.
85 ////////////////////////////////////////////////////////////////////
87 update_internals(PartBundle *, PartGroup *, bool, bool, Thread *current_thread) {
88  // Tell our related CharacterVertexSliders that they now need to
89  // recompute themselves.
90  VertexSliders::iterator vsi;
91  for (vsi = _vertex_sliders.begin(); vsi != _vertex_sliders.end(); ++vsi) {
92  (*vsi)->mark_modified(current_thread);
93  }
94 
95  return true;
96 }
97 
98 ////////////////////////////////////////////////////////////////////
99 // Function: CharacterSlider::make_CharacterSlider
100 // Access: Protected
101 // Description: Factory method to generate a CharacterSlider object
102 ////////////////////////////////////////////////////////////////////
105 {
107  DatagramIterator scan;
108  BamReader *manager;
109 
110  parse_params(params, scan, manager);
111  me->fillin(scan, manager);
112  return me;
113 }
114 
115 ////////////////////////////////////////////////////////////////////
116 // Function: CharacterSlider::register_with_factory
117 // Access: Public, Static
118 // Description: Factory method to generate a CharacterSlider object
119 ////////////////////////////////////////////////////////////////////
122 {
124 }
125 
126 
127 
128 
virtual bool update_internals(PartBundle *root, PartGroup *parent, bool self_changed, bool parent_changed, Thread *current_thread)
This is called by do_update() whenever the part or some ancestor has changed values.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
static void register_with_read_factory()
Factory method to generate a CharacterSlider object.
static TypedWritable * make_CharacterSlider(const FactoryParams &params)
Factory method to generate a CharacterSlider object.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is a morph slider within the character.
virtual PartGroup * make_copy() const
Allocates and returns a new copy of the node.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
Definition: factory.I:90
This is a particular kind of MovingPart that accepts a scalar each frame.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
Definition: bamReader.I:213
A thread; that is, a lightweight process.
Definition: thread.h:51
This is the root of a MovingPart hierarchy.
Definition: partBundle.h:49
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:45