better handling for non-blending case

This commit is contained in:
David Rose 2008-08-18 23:11:16 +00:00
parent 9e9e1eeef7
commit 0a0bf8e38f
2 changed files with 34 additions and 16 deletions

View File

@ -77,23 +77,32 @@ get_blend_value(const PartBundle *root) {
_value = _initial_value; _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. // A single value, the normal case.
AnimControl *control = (*cdata->_blend.begin()).first; AnimControl *bound_control = NULL;
ChannelType *bound_channel = NULL;
ChannelType *channel = NULL; 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(); int channel_index = control->get_channel_index();
if (channel_index >= 0 && channel_index < (int)_channels.size()) { if (channel_index >= 0 && channel_index < (int)_channels.size()) {
channel = DCAST(ChannelType, _channels[channel_index]); bound_control = control;
bound_channel = DCAST(ChannelType, _channels[channel_index]);
} }
if (channel == (ChannelType *)NULL) { }
if (bound_channel == (ChannelType *)NULL) {
// Nothing is actually bound here. // Nothing is actually bound here.
if (restore_initial_pose) { if (restore_initial_pose) {
_value = _initial_value; _value = _initial_value;
} }
} else { } else {
channel->get_value(control->get_frame(), _value); bound_channel->get_value(bound_control->get_frame(), _value);
} }
} else { } else {

View File

@ -62,23 +62,32 @@ get_blend_value(const PartBundle *root) {
_value = _initial_value; _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. // A single value, the normal case.
AnimControl *control = (*cdata->_blend.begin()).first; AnimControl *bound_control = NULL;
ChannelType *bound_channel = NULL;
ChannelType *channel = NULL; 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(); int channel_index = control->get_channel_index();
if (channel_index >= 0 && channel_index < (int)_channels.size()) { if (channel_index >= 0 && channel_index < (int)_channels.size()) {
channel = DCAST(ChannelType, _channels[channel_index]); bound_control = control;
bound_channel = DCAST(ChannelType, _channels[channel_index]);
} }
if (channel == NULL) { }
if (bound_channel == NULL) {
// Nothing is actually bound here. // Nothing is actually bound here.
if (restore_initial_pose) { if (restore_initial_pose) {
_value = _initial_value; _value = _initial_value;
} }
} else { } else {
channel->get_value(control->get_frame(), _value); bound_channel->get_value(bound_control->get_frame(), _value);
} }
} else { } else {