Fix AnimatedSprite infinite loop

(cherry picked from commit 3a439a9c03)
This commit is contained in:
Haoyu Qiu 2022-02-28 16:00:45 +08:00 committed by Rémi Verschelde
parent 824eaabd7b
commit 7e07d4781a
2 changed files with 10 additions and 10 deletions

View File

@ -364,14 +364,14 @@ void AnimatedSprite::_notification(int p_what) {
return;
}
float speed = frames->get_animation_speed(animation) * speed_scale;
if (speed == 0) {
return; //do nothing
}
float remaining = get_process_delta_time();
while (remaining) {
float speed = frames->get_animation_speed(animation) * speed_scale;
if (speed == 0) {
return; //do nothing
}
if (timeout <= 0) {
timeout = _get_frame_duration();

View File

@ -980,14 +980,14 @@ void AnimatedSprite3D::_notification(int p_what) {
return;
}
float speed = frames->get_animation_speed(animation);
if (speed == 0) {
return; //do nothing
}
float remaining = get_process_delta_time();
while (remaining) {
float speed = frames->get_animation_speed(animation);
if (speed == 0) {
return; // Do nothing.
}
if (timeout <= 0) {
timeout = 1.0 / speed;