mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fix #445 by NOT replacing empty backups
This commit is contained in:
parent
499251f44a
commit
5b3b91b247
|
@ -46,7 +46,7 @@ func handle_loading_image(file : String, image : Image) -> void:
|
|||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
||||
func open_pxo_file(path : String, untitled_backup : bool = false, replace_empty : bool = true) -> void:
|
||||
var file := File.new()
|
||||
var err := file.open_compressed(path, File.READ, File.COMPRESSION_ZSTD)
|
||||
if err == ERR_FILE_UNRECOGNIZED:
|
||||
|
@ -59,7 +59,7 @@ func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
|||
file.close()
|
||||
return
|
||||
|
||||
var empty_project : bool = Global.current_project.frames.size() == 1 and Global.current_project.layers.size() == 1 and Global.current_project.frames[0].cels[0].image.is_invisible() and Global.current_project.animation_tags.size() == 0
|
||||
var empty_project : bool = Global.current_project.is_empty() and replace_empty
|
||||
var new_project : Project
|
||||
if empty_project:
|
||||
new_project = Global.current_project
|
||||
|
@ -547,7 +547,7 @@ func reload_backup_file(project_paths : Array, backup_paths : Array) -> void:
|
|||
|
||||
# Load the backup files
|
||||
for i in range(project_paths.size()):
|
||||
open_pxo_file(backup_paths[i], project_paths[i] == backup_paths[i])
|
||||
open_pxo_file(backup_paths[i], project_paths[i] == backup_paths[i], i == 0)
|
||||
backup_save_paths[i] = backup_paths[i]
|
||||
|
||||
# If project path is the same as backup save path -> the backup was untitled
|
||||
|
|
|
@ -580,3 +580,7 @@ func update_tile_mode_rects() -> void:
|
|||
tile_mode_rects[Global.TileMode.BOTH] = Rect2(Vector2(-1, -1) * size, Vector2(3, 3) * size)
|
||||
tile_mode_rects[Global.TileMode.X_AXIS] = Rect2(Vector2(-1, 0) * size, Vector2(3, 1) * size)
|
||||
tile_mode_rects[Global.TileMode.Y_AXIS] = Rect2(Vector2(0, -1) * size, Vector2(1, 3) * size)
|
||||
|
||||
|
||||
func is_empty() -> bool:
|
||||
return frames.size() == 1 and layers.size() == 1 and frames[0].cels[0].image.is_invisible() and animation_tags.size() == 0
|
||||
|
|
Loading…
Reference in a new issue