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