Fix wrong blend of animation tree
Interpolation cannot use zero values, must use the values from the
animation to be blended.
(cherry picked from commit 45d97b9860
)
This commit is contained in:
parent
16097dd174
commit
aedea36d0c
|
@ -883,17 +883,17 @@ void AnimationTree::_process_graph(float p_delta) {
|
||||||
|
|
||||||
TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
|
TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
|
||||||
|
|
||||||
if (t->process_pass != process_pass) {
|
|
||||||
|
|
||||||
t->process_pass = process_pass;
|
|
||||||
t->loc = Vector3();
|
|
||||||
t->rot = Quat();
|
|
||||||
t->rot_blend_accum = 0;
|
|
||||||
t->scale = Vector3();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (track->root_motion) {
|
if (track->root_motion) {
|
||||||
|
|
||||||
|
if (t->process_pass != process_pass) {
|
||||||
|
|
||||||
|
t->process_pass = process_pass;
|
||||||
|
t->loc = Vector3();
|
||||||
|
t->rot = Quat();
|
||||||
|
t->rot_blend_accum = 0;
|
||||||
|
t->scale = Vector3();
|
||||||
|
}
|
||||||
|
|
||||||
float prev_time = time - delta;
|
float prev_time = time - delta;
|
||||||
if (prev_time < 0) {
|
if (prev_time < 0) {
|
||||||
if (!a->has_loop()) {
|
if (!a->has_loop()) {
|
||||||
|
@ -946,6 +946,15 @@ void AnimationTree::_process_graph(float p_delta) {
|
||||||
Error err = a->transform_track_interpolate(i, time, &loc, &rot, &scale);
|
Error err = a->transform_track_interpolate(i, time, &loc, &rot, &scale);
|
||||||
//ERR_CONTINUE(err!=OK); //used for testing, should be removed
|
//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
|
scale -= Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes
|
||||||
|
|
||||||
if (err != OK)
|
if (err != OK)
|
||||||
|
@ -978,8 +987,7 @@ void AnimationTree::_process_graph(float p_delta) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (t->process_pass != process_pass) {
|
if (t->process_pass != process_pass) {
|
||||||
Variant::CallError ce;
|
t->value = value;
|
||||||
t->value = Variant::construct(value.get_type(), NULL, 0, ce); //reset
|
|
||||||
t->process_pass = process_pass;
|
t->process_pass = process_pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1036,7 +1044,7 @@ void AnimationTree::_process_graph(float p_delta) {
|
||||||
float bezier = a->bezier_track_interpolate(i, time);
|
float bezier = a->bezier_track_interpolate(i, time);
|
||||||
|
|
||||||
if (t->process_pass != process_pass) {
|
if (t->process_pass != process_pass) {
|
||||||
t->value = 0;
|
t->value = bezier;
|
||||||
t->process_pass = process_pass;
|
t->process_pass = process_pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue