16 #include "movingPartScalar.h"
17 #include "animChannelScalarDynamic.h"
19 #include "datagramIterator.h"
20 #include "bamReader.h"
21 #include "bamWriter.h"
22 #include "config_chan.h"
26 #pragma implementation
54 channel->get_value(0, _value);
60 if (cdata->_blend.empty()) {
62 if (restore_initial_pose) {
63 _value = _default_value;
66 }
else if (_effective_control != (
AnimControl *)NULL &&
67 !cdata->_frame_blend_flag) {
70 channel->get_value(_effective_control->get_frame(), _value);
75 PN_stdfloat net = 0.0f;
77 PartBundle::ChannelBlend::const_iterator cbi;
78 for (cbi = cdata->_blend.begin(); cbi != cdata->_blend.end(); ++cbi) {
80 PN_stdfloat effect = (*cbi).second;
81 nassertv(effect != 0.0f);
85 if (channel_index >= 0 && channel_index < (
int)_channels.size()) {
86 channel = DCAST(
ChannelType, _channels[channel_index]);
88 if (channel != NULL) {
90 channel->get_value(control->
get_frame(), v);
92 if (!cdata->_frame_blend_flag) {
97 PN_stdfloat frac = (PN_stdfloat)control->
get_frac();
98 _value += v * (effect * (1.0f - frac));
101 _value += v * (effect * frac);
108 if (restore_initial_pose) {
109 _value = _default_value;
146 _forced_channel = chan;
161 parse_params(params, scan, manager);
162 me->fillin(scan, manager);
A basic node of the scene graph or data graph.
static TypedWritable * make_MovingPartScalar(const FactoryParams ¶ms)
Factory method to generate a MovingPartScalar object.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
double get_frac() const
Returns the fractional part of the current frame.
Base class for objects that can be written to and read from Bam files.
static void register_with_read_factory()
Factory method to generate a MovingPartScalar object.
void set_value_node(PandaNode *node)
Specifies a node whose transform will be queried each frame to implicitly specify the transform of th...
This template class is the parent class for all kinds of AnimChannels that return different values...
virtual bool apply_freeze_scalar(PN_stdfloat value)
Freezes this particular joint so that it will always hold the specified transform.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
int get_frame() const
Returns the current integer frame number.
Parent class for all animation channels.
virtual bool apply_control(PandaNode *node)
Specifies a node to influence this particular joint so that it will always hold the node's transform...
This template class is a special kind of AnimChannel that always returns just one fixed value...
int get_next_frame() const
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames().
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual void get_blend_value(const PartBundle *root)
Attempts to blend the various scalar values indicated, and sets the _value member to the resulting sc...
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
An animation channel that accepts a scalar each frame from some dynamic input provided by code...
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.
This is the root of a MovingPart hierarchy.
Controls the timing of a character animation.
A class to retrieve the individual data elements previously stored in a Datagram. ...
int get_channel_index() const
Returns the particular channel index associated with this AnimControl.
TypeHandle is the identifier used to differentiate C++ class types.