diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-03-01 14:02:11 +0100 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-03-01 14:02:11 +0100 |
commit | 46bfcd350745d3053a0cab2985d73baae0a4a88d (patch) | |
tree | 441cc6fba550581f8753ed254ca5b6774afb47ff /scene/animation/animation_tree_player.cpp | |
parent | c26f753ffe0e853bc248a76165935f169cb2dbbb (diff) | |
parent | b79351aa455f0c16144f4f148fad7ba8be94049f (diff) |
Merge pull request #3858 from JoshuaGrams/blend3
AnimationTreePlayer (Blend3): process all inputs.
Diffstat (limited to 'scene/animation/animation_tree_player.cpp')
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 2594d65ae6..b07611b318 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -607,20 +607,21 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode Blend3Node *bn = static_cast<Blend3Node*>(nb); float rem; - - if (bn->value==0) { - rem = _process_node(bn->inputs[1].node,r_prev_anim,p_weight,p_time,switched,p_seek,p_filter,p_reverse_weight); - } else if (bn->value>0) { - - rem = _process_node(bn->inputs[1].node,r_prev_anim,p_weight*(1.0-bn->value),p_time,switched,p_seek,p_filter,p_reverse_weight*(1.0-bn->value)); - _process_node(bn->inputs[2].node,r_prev_anim,p_weight*bn->value,p_time,switched,p_seek,p_filter,p_reverse_weight*bn->value); - + float blend, lower_blend, upper_blend; + if (bn->value < 0) { + lower_blend = -bn->value; + blend = 1.0 - lower_blend; + upper_blend = 0; } else { - - rem = _process_node(bn->inputs[1].node,r_prev_anim,p_weight*(1.0+bn->value),p_time,switched,p_seek,p_filter,p_reverse_weight*(1.0+bn->value)); - _process_node(bn->inputs[0].node,r_prev_anim,p_weight*-bn->value,p_time,switched,p_seek,p_filter,p_reverse_weight*-bn->value); + lower_blend = 0; + blend = 1.0 - bn->value; + upper_blend = bn->value; } + rem = _process_node(bn->inputs[1].node,r_prev_anim,p_weight*blend,p_time,switched,p_seek,p_filter,p_reverse_weight*blend); + _process_node(bn->inputs[2].node,r_prev_anim,p_weight*upper_blend,p_time,switched,p_seek,p_filter,p_reverse_weight*upper_blend); + _process_node(bn->inputs[0].node,r_prev_anim,p_weight*lower_blend,p_time,switched,p_seek,p_filter,p_reverse_weight*lower_blend); + return rem; } break; case NODE_BLEND4: { |