Merge pull request #54827 from timothyqiu/watch-your-step

[3.x] Fix AnimationTree function call track loop
This commit is contained in:
Rémi Verschelde 2022-01-19 08:15:16 +01:00 committed by GitHub
commit 99cebb30dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,7 +67,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) {
AnimationPlayer *ap = state->player;
ERR_FAIL_COND_V(!ap, 0);
float time = get_parameter(this->time);
const float current_time = get_parameter(this->time);
if (!ap->has_animation(animation)) {
AnimationNodeBlendTree *tree = Object::cast_to<AnimationNodeBlendTree>(parent);
@ -84,6 +84,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) {
Ref<Animation> anim = ap->get_animation(animation);
float time = current_time;
float step;
if (p_seek) {
@ -103,6 +104,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) {
} else if (time > anim_size) {
time = anim_size;
step = anim_size - current_time;
}
blend_animation(animation, time, step, p_seek, 1.0);