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 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
Definition: bamReader.I:177
This is a morph slider within the character.
static TypedWritable * make_CharacterSlider(const FactoryParams &params)
Factory method to generate a CharacterSlider object.
static void register_with_read_factory()
Factory method to generate a CharacterSlider object.
virtual PartGroup * make_copy() const
Allocates and returns a new copy of the node.
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.
A class to retrieve the individual data elements previously stored in a Datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
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
This is a particular kind of MovingPart that accepts a scalar each frame.
This is the root of a MovingPart hierarchy.
Definition: partBundle.h:46
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:43
A thread; that is, a lightweight process.
Definition: thread.h:46
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.