Merge pull request #58623 from timothyqiu/animated-sprite

Fix `AnimatedSprite` infinite loop
This commit is contained in:
Rémi Verschelde 2022-02-28 10:48:16 +01:00 committed by GitHub
commit 2e45884252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

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

View file

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