mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 13:54:44 -04:00
Made pxo saving a bit safer
It now first attempts to serialize the project data and turn them to JSON, and then opens the file. This is a lto safer because, if a crash happens in the serialization, the file is not already open, and therefore it does not get corrupt. Earlier, if a crash happened, the file would be empty. This meant that if that file existed previously, all of the data would be lost.
This commit is contained in:
parent
852365c38f
commit
e94bcf50e0
5 changed files with 58 additions and 50 deletions
|
@ -65,7 +65,7 @@ func _on_DeleteFrame_pressed(frame := -1) -> void:
|
|||
return
|
||||
if frame == -1:
|
||||
frame = Global.current_project.current_frame
|
||||
|
||||
|
||||
var frame_duration : Array = Global.current_project.frame_duration.duplicate()
|
||||
frame_duration.remove(frame)
|
||||
var frame_to_delete : Frame = Global.current_project.frames[frame]
|
||||
|
@ -311,7 +311,7 @@ func play_animation(play : bool, forward_dir : bool) -> void:
|
|||
|
||||
if play:
|
||||
Global.animation_timer.set_one_shot(true) #The wait_time it can't change correctly if it is playing
|
||||
Global.animation_timer.wait_time = Global.current_project.frame_duration[Global.current_project.current_frame] * (1 / fps)
|
||||
Global.animation_timer.wait_time = Global.current_project.frame_duration[Global.current_project.current_frame] * (1 / fps)
|
||||
Global.animation_timer.start()
|
||||
animation_forward = forward_dir
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue