diff --git a/panda/src/chan/movingPartMatrix.cxx b/panda/src/chan/movingPartMatrix.cxx index 6a7989256f..d3e5c867d8 100644 --- a/panda/src/chan/movingPartMatrix.cxx +++ b/panda/src/chan/movingPartMatrix.cxx @@ -77,23 +77,32 @@ get_blend_value(const PartBundle *root) { _value = _initial_value; } - } else if (cdata->_blend.size() == 1 && !cdata->_frame_blend_flag) { + } else if ((cdata->_blend.size() == 1 || !cdata->_anim_blend_flag) && + !cdata->_frame_blend_flag) { // A single value, the normal case. - AnimControl *control = (*cdata->_blend.begin()).first; + AnimControl *bound_control = NULL; + ChannelType *bound_channel = NULL; - ChannelType *channel = NULL; - int channel_index = control->get_channel_index(); - if (channel_index >= 0 && channel_index < (int)_channels.size()) { - channel = DCAST(ChannelType, _channels[channel_index]); + PartBundle::ChannelBlend::const_iterator cbi; + for (cbi = cdata->_blend.begin(); + cbi != cdata->_blend.end() && bound_channel == (ChannelType *)NULL; + ++cbi) { + AnimControl *control = (*cbi).first; + int channel_index = control->get_channel_index(); + if (channel_index >= 0 && channel_index < (int)_channels.size()) { + bound_control = control; + bound_channel = DCAST(ChannelType, _channels[channel_index]); + } } - if (channel == (ChannelType *)NULL) { + + if (bound_channel == (ChannelType *)NULL) { // Nothing is actually bound here. if (restore_initial_pose) { _value = _initial_value; } } else { - channel->get_value(control->get_frame(), _value); + bound_channel->get_value(bound_control->get_frame(), _value); } } else { diff --git a/panda/src/chan/movingPartScalar.cxx b/panda/src/chan/movingPartScalar.cxx index 14d03e8b35..c95bf0134c 100644 --- a/panda/src/chan/movingPartScalar.cxx +++ b/panda/src/chan/movingPartScalar.cxx @@ -62,23 +62,32 @@ get_blend_value(const PartBundle *root) { _value = _initial_value; } - } else if (cdata->_blend.size() == 1 && !cdata->_frame_blend_flag) { + } else if ((cdata->_blend.size() == 1 || !cdata->_anim_blend_flag) && + !cdata->_frame_blend_flag) { // A single value, the normal case. - AnimControl *control = (*cdata->_blend.begin()).first; + AnimControl *bound_control = NULL; + ChannelType *bound_channel = NULL; - ChannelType *channel = NULL; - int channel_index = control->get_channel_index(); - if (channel_index >= 0 && channel_index < (int)_channels.size()) { - channel = DCAST(ChannelType, _channels[channel_index]); + PartBundle::ChannelBlend::const_iterator cbi; + for (cbi = cdata->_blend.begin(); + cbi != cdata->_blend.end() && bound_channel == (ChannelType *)NULL; + ++cbi) { + AnimControl *control = (*cbi).first; + int channel_index = control->get_channel_index(); + if (channel_index >= 0 && channel_index < (int)_channels.size()) { + bound_control = control; + bound_channel = DCAST(ChannelType, _channels[channel_index]); + } } - if (channel == NULL) { + + if (bound_channel == NULL) { // Nothing is actually bound here. if (restore_initial_pose) { _value = _initial_value; } } else { - channel->get_value(control->get_frame(), _value); + bound_channel->get_value(bound_control->get_frame(), _value); } } else {