mirror of
https://github.com/godotengine/godot.git
synced 2025-02-23 23:15:07 +08:00
Fix AnimatedSprite infinite loop
This commit is contained in:
parent
353be6261f
commit
3a439a9c03
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user