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() {
52  nassertv(_vertex_sliders.empty());
53 }
54 
55 /**
56  * Allocates and returns a new copy of the node. Children are not copied, but
57  * see copy_subgraph().
58  */
60 make_copy() const {
61  return new CharacterSlider(*this);
62 }
63 
64 /**
65  * This is called by do_update() whenever the part or some ancestor has
66  * changed values. It is a hook for derived classes to update whatever cache
67  * they may have that depends on these.
68  *
69  * The return value is true if the part has changed as a result of the update,
70  * or false otherwise.
71  */
73 update_internals(PartBundle *, PartGroup *, bool, bool, Thread *current_thread) {
74  // Tell our related CharacterVertexSliders that they now need to recompute
75  // themselves.
76  VertexSliders::iterator vsi;
77  for (vsi = _vertex_sliders.begin(); vsi != _vertex_sliders.end(); ++vsi) {
78  (*vsi)->mark_modified(current_thread);
79  }
80 
81  return true;
82 }
83 
84 /**
85  * Factory method to generate a CharacterSlider object
86  */
89 {
91  DatagramIterator scan;
92  BamReader *manager;
93 
94  parse_params(params, scan, manager);
95  me->fillin(scan, manager);
96  return me;
97 }
98 
99 /**
100  * Factory method to generate a CharacterSlider object
101  */
104 {
106 }
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual PartGroup * make_copy() const
Allocates and returns a new copy of the node.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
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:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a morph slider within the character.
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
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:177
A thread; that is, a lightweight process.
Definition: thread.h:46
This is the root of a MovingPart hierarchy.
Definition: partBundle.h:46
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:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:43