diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-01 16:38:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 16:38:55 +0200 |
commit | e91844e8dca5d03eabd33e867fdbceb18db60cff (patch) | |
tree | 3fe75cb966866c3ff59beba10b8b793295ec3502 | |
parent | dee98d3b6d58cbe42fc403d999b278aec9447105 (diff) | |
parent | 45d97b9860049414da61f4d6c69f3fd653b7c256 (diff) |
Merge pull request #27562 from guilhermefelipecgs/fix_27484
Fix wrong blend of animation tree
-rw-r--r-- | scene/animation/animation_tree.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 0b6fa26bfc..fe1b8247ff 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -883,16 +883,16 @@ void AnimationTree::_process_graph(float p_delta) { TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track); - if (t->process_pass != process_pass) { + if (track->root_motion) { - t->process_pass = process_pass; - t->loc = Vector3(); - t->rot = Quat(); - t->rot_blend_accum = 0; - t->scale = Vector3(); - } + if (t->process_pass != process_pass) { - if (track->root_motion) { + t->process_pass = process_pass; + t->loc = Vector3(); + t->rot = Quat(); + t->rot_blend_accum = 0; + t->scale = Vector3(); + } float prev_time = time - delta; if (prev_time < 0) { @@ -946,6 +946,15 @@ void AnimationTree::_process_graph(float p_delta) { Error err = a->transform_track_interpolate(i, time, &loc, &rot, &scale); //ERR_CONTINUE(err!=OK); //used for testing, should be removed + if (t->process_pass != process_pass) { + + t->process_pass = process_pass; + t->loc = loc; + t->rot = rot; + t->rot_blend_accum = 0; + t->scale = Vector3(); + } + scale -= Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes if (err != OK) @@ -978,8 +987,7 @@ void AnimationTree::_process_graph(float p_delta) { continue; if (t->process_pass != process_pass) { - Variant::CallError ce; - t->value = Variant::construct(value.get_type(), NULL, 0, ce); //reset + t->value = value; t->process_pass = process_pass; } @@ -1036,7 +1044,7 @@ void AnimationTree::_process_graph(float p_delta) { float bezier = a->bezier_track_interpolate(i, time); if (t->process_pass != process_pass) { - t->value = 0; + t->value = bezier; t->process_pass = process_pass; } |