diff options
| author | Rémi Verschelde | 2016-03-01 14:01:27 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2016-03-01 14:01:27 +0100 |
| commit | c26f753ffe0e853bc248a76165935f169cb2dbbb (patch) | |
| tree | fbb1ea115bd472306be53c02186ff0941961e0dd /scene/animation | |
| parent | a12c63ef9e6332d0003228e1d8d79a57ef3995fb (diff) | |
| parent | 391ce81c5ea037ffcbc525434673f4edd55a7d7e (diff) | |
| download | godot-c26f753ffe0e853bc248a76165935f169cb2dbbb.tar.gz godot-c26f753ffe0e853bc248a76165935f169cb2dbbb.tar.zst godot-c26f753ffe0e853bc248a76165935f169cb2dbbb.zip | |
Merge pull request #3757 from JoshuaGrams/animation-tree-blending
AnimationTreePlayer: blend value tracks (intended to close #2299)
Diffstat (limited to 'scene/animation')
| -rw-r--r-- | scene/animation/animation_tree_player.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 77d9f77bb..2594d65ae 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -768,6 +768,10 @@ void AnimationTreePlayer::_process_animation(float p_delta) { t.scale.x=0; t.scale.y=0; t.scale.z=0; + + Variant value = t.node->get(t.property); + value.zero(); + t.node->set(t.property, value); } @@ -777,11 +781,9 @@ void AnimationTreePlayer::_process_animation(float p_delta) { Quat empty_rot; - int total = 0; while(anim_list) { if (!anim_list->animation.is_null() && !anim_list->skip) { - ++total; //check if animation is meaningful Animation *a = anim_list->animation.operator->(); @@ -816,8 +818,9 @@ void AnimationTreePlayer::_process_animation(float p_delta) { case Animation::TYPE_VALUE: { ///< Set a value in a property, can be interpolated. if (a->value_track_is_continuous(tr.local_track)) { - Variant value = a->value_track_interpolate(tr.local_track,anim_list->time); - tr.track->node->set(tr.track->property,value); + Variant blended, value = a->value_track_interpolate(tr.local_track,anim_list->time); + Variant::blend(tr.track->node->get(tr.track->property),value,blend,blended); + tr.track->node->set(tr.track->property,blended); } else { List<int> indices; |
