42 if (_forced_channel !=
nullptr) {
44 channel->get_value(0, _value);
50 if (cdata->_blend.empty()) {
52 if (restore_initial_pose) {
53 _value = _default_value;
56 }
else if (_effective_control !=
nullptr &&
57 !cdata->_frame_blend_flag) {
60 channel->get_value(_effective_control->get_frame(), _value);
65 PN_stdfloat net = 0.0f;
67 PartBundle::ChannelBlend::const_iterator cbi;
68 for (cbi = cdata->_blend.begin(); cbi != cdata->_blend.end(); ++cbi) {
70 PN_stdfloat effect = (*cbi).second;
71 nassertv(effect != 0.0f);
75 if (channel_index >= 0 && channel_index < (
int)_channels.size()) {
76 channel = DCAST(
ChannelType, _channels[channel_index]);
78 if (channel !=
nullptr) {
80 channel->get_value(control->
get_frame(), v);
82 if (!cdata->_frame_blend_flag) {
87 PN_stdfloat frac = (PN_stdfloat)control->
get_frac();
88 _value += v * (effect * (1.0f - frac));
91 _value += v * (effect * frac);
98 if (restore_initial_pose) {
99 _value = _default_value;
129 _forced_channel = chan;
143 me->fillin(scan, manager);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This template class is a special kind of AnimChannel that always returns just one fixed value.
An animation channel that accepts a scalar each frame from some dynamic input provided by code.
set_value_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.
Controls the timing of a character animation.
int get_channel_index() const
Returns the particular channel index associated with this AnimControl.
get_frame
Returns the current integer frame number.
get_next_frame
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames().
get_frac
Returns the fractional part of the current frame.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
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...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
This is a particular kind of MovingPart that accepts a scalar each frame.
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...
static void register_with_read_factory()
Factory method to generate a MovingPartScalar object.
static TypedWritable * make_MovingPartScalar(const FactoryParams ¶ms)
Factory method to generate a MovingPartScalar object.
virtual bool apply_freeze_scalar(PN_stdfloat value)
Freezes this particular joint so that it will always hold the specified transform.
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 is the template instantiation of MovingPartBase, on the particular type of value provided by the...
A basic node of the scene graph or data graph.
This is the root of a MovingPart hierarchy.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.