From 42bce917dc4cb8cfbc3d82a59735c2f0247bef6f Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:54:00 +0200 Subject: [PATCH] Never change window title and save path when loading a backup --- src/Autoload/OpenSave.gd | 8 ++++---- src/Classes/Project.gd | 3 --- src/Main.gd | 7 ------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Autoload/OpenSave.gd b/src/Autoload/OpenSave.gd index e431040ab..b8e9ff5a4 100644 --- a/src/Autoload/OpenSave.gd +++ b/src/Autoload/OpenSave.gd @@ -182,7 +182,7 @@ func handle_loading_video(file: String) -> bool: return true -func open_pxo_file(path: String, untitled_backup := false, replace_empty := true) -> void: +func open_pxo_file(path: String, is_backup := false, replace_empty := true) -> void: var empty_project := Global.current_project.is_empty() and replace_empty var new_project: Project var zip_reader := ZIPReader.new() @@ -253,8 +253,8 @@ func open_pxo_file(path: String, untitled_backup := false, replace_empty := true Global.tabs.current_tab = Global.tabs.get_tab_count() - 1 Global.canvas.camera_zoom() - if not untitled_backup: - # Untitled backup should not change window title and save path + if not is_backup: + # Loading a backup should not change window title and save path current_save_paths[Global.current_project_index] = path Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version Global.save_sprites_dialog.current_path = path @@ -875,7 +875,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], i == 0) + open_pxo_file(backup_paths[i], true, i == 0) backup_save_paths[i] = backup_paths[i] # If project path is the same as backup save path -> the backup was untitled diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 00bd2b541..c8434d235 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -337,7 +337,6 @@ func serialize() -> Dictionary: "tile_mode_x_basis_y": tiles.x_basis.y, "tile_mode_y_basis_x": tiles.y_basis.x, "tile_mode_y_basis_y": tiles.y_basis.y, - "save_path": OpenSave.current_save_paths[Global.projects.find(self)], "layers": layer_data, "tags": tag_data, "guides": guide_data, @@ -369,8 +368,6 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces if dict.has("tile_mode_y_basis_x") and dict.has("tile_mode_y_basis_y"): tiles.y_basis.x = dict.tile_mode_y_basis_x tiles.y_basis.y = dict.tile_mode_y_basis_y - if dict.has("save_path"): - OpenSave.current_save_paths[Global.projects.find(self)] = dict.save_path if dict.has("frames") and dict.has("layers"): for saved_layer in dict.layers: match int(saved_layer.get("type", Global.LayerTypes.PIXEL)): diff --git a/src/Main.gd b/src/Main.gd index 53d834ba2..55f5f2e87 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -369,13 +369,6 @@ func _quit() -> void: func _on_BackupConfirmation_confirmed(project_paths: Array, backup_paths: Array) -> void: OpenSave.reload_backup_file(project_paths, backup_paths) - Global.current_project.file_name = OpenSave.current_save_paths[0].get_file().trim_suffix(".pxo") - Global.current_project.export_directory_path = OpenSave.current_save_paths[0].get_base_dir() - Global.current_project.was_exported = false - Global.top_menu_container.file_menu.set_item_text( - Global.FileMenu.SAVE, tr("Save") + " %s" % OpenSave.current_save_paths[0].get_file() - ) - Global.top_menu_container.file_menu.set_item_text(Global.FileMenu.EXPORT, tr("Export")) func _on_BackupConfirmation_custom_action(