mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Fixed stack overflow crash when the user set the loop mode to ping-pong and played the animation on a single frame with its own tag
The crash only occured when it was one frame in that tag, but there were also more frames in general. A very rare scenario.
This commit is contained in:
parent
0e807c176f
commit
7dbea9c0b0
|
@ -254,6 +254,8 @@ func _input(event : InputEvent) -> void:
|
||||||
if Engine.get_version_info().major == 3 && Engine.get_version_info().minor >= 2:
|
if Engine.get_version_info().major == 3 && Engine.get_version_info().minor >= 2:
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
pen_pressure = event.pressure
|
pen_pressure = event.pressure
|
||||||
|
|
||||||
|
# To be removed once Godot 3.2.2 is out of beta
|
||||||
if event.pressure == 0.0: # Drawing with mouse
|
if event.pressure == 0.0: # Drawing with mouse
|
||||||
pen_pressure = 1 # This causes problems with tablets though
|
pen_pressure = 1 # This causes problems with tablets though
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,10 @@ func _on_PlayBackwards_toggled(button_pressed : bool) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimationTimer_timeout() -> void:
|
func _on_AnimationTimer_timeout() -> void:
|
||||||
|
if first_frame == last_frame:
|
||||||
|
$AnimationTimer.stop()
|
||||||
|
return
|
||||||
|
|
||||||
if animation_forward:
|
if animation_forward:
|
||||||
if Global.current_frame < last_frame:
|
if Global.current_frame < last_frame:
|
||||||
Global.current_frame += 1
|
Global.current_frame += 1
|
||||||
|
@ -257,6 +261,21 @@ func _on_AnimationTimer_timeout() -> void:
|
||||||
|
|
||||||
|
|
||||||
func play_animation(play : bool, forward_dir : bool) -> void:
|
func play_animation(play : bool, forward_dir : bool) -> void:
|
||||||
|
first_frame = 0
|
||||||
|
last_frame = Global.canvases.size() - 1
|
||||||
|
if Global.play_only_tags:
|
||||||
|
for tag in Global.animation_tags:
|
||||||
|
if Global.current_frame + 1 >= tag[2] && Global.current_frame + 1 <= tag[3]:
|
||||||
|
first_frame = tag[2] - 1
|
||||||
|
last_frame = min(Global.canvases.size() - 1, tag[3] - 1)
|
||||||
|
|
||||||
|
if first_frame == last_frame:
|
||||||
|
if forward_dir:
|
||||||
|
Global.play_forward.pressed = false
|
||||||
|
else:
|
||||||
|
Global.play_backwards.pressed = false
|
||||||
|
return
|
||||||
|
|
||||||
if forward_dir:
|
if forward_dir:
|
||||||
Global.play_backwards.disconnect("toggled", self, "_on_PlayBackwards_toggled")
|
Global.play_backwards.disconnect("toggled", self, "_on_PlayBackwards_toggled")
|
||||||
Global.play_backwards.pressed = false
|
Global.play_backwards.pressed = false
|
||||||
|
@ -267,20 +286,6 @@ func play_animation(play : bool, forward_dir : bool) -> void:
|
||||||
Global.play_forward.pressed = false
|
Global.play_forward.pressed = false
|
||||||
Global.change_button_texturerect(Global.play_forward.get_child(0), "play.png")
|
Global.change_button_texturerect(Global.play_forward.get_child(0), "play.png")
|
||||||
Global.play_forward.connect("toggled", self, "_on_PlayForward_toggled")
|
Global.play_forward.connect("toggled", self, "_on_PlayForward_toggled")
|
||||||
if Global.canvases.size() == 1:
|
|
||||||
if forward_dir:
|
|
||||||
Global.play_forward.pressed = false
|
|
||||||
else:
|
|
||||||
Global.play_backwards.pressed = false
|
|
||||||
return
|
|
||||||
|
|
||||||
first_frame = 0
|
|
||||||
last_frame = Global.canvases.size() - 1
|
|
||||||
if Global.play_only_tags:
|
|
||||||
for tag in Global.animation_tags:
|
|
||||||
if Global.current_frame + 1 >= tag[2] && Global.current_frame + 1 <= tag[3]:
|
|
||||||
first_frame = tag[2] - 1
|
|
||||||
last_frame = min(Global.canvases.size() - 1, tag[3] - 1)
|
|
||||||
|
|
||||||
if play:
|
if play:
|
||||||
Global.animation_timer.wait_time = 1 / fps
|
Global.animation_timer.wait_time = 1 / fps
|
||||||
|
|
Loading…
Reference in a new issue