mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Minor open/save dialog path related code cleaning
This commit is contained in:
parent
60af6b27e3
commit
ad85c8dd3e
|
@ -242,6 +242,7 @@ func open_pxo_file(path: String, untitled_backup := false, replace_empty := true
|
|||
else:
|
||||
new_project.tiles.reset_mask()
|
||||
zip_reader.close()
|
||||
new_project.export_directory_path = path.get_basename()
|
||||
|
||||
if empty_project:
|
||||
new_project.change_project()
|
||||
|
@ -258,6 +259,7 @@ func open_pxo_file(path: String, untitled_backup := false, replace_empty := true
|
|||
Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version
|
||||
Global.save_sprites_dialog.current_path = path
|
||||
# Set last opened project path and save
|
||||
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
|
||||
Global.config_cache.set_value("data", "last_project_path", path)
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
new_project.export_directory_path = path.get_base_dir()
|
||||
|
@ -420,6 +422,7 @@ func save_pxo_file(
|
|||
Global.main_window.title = path.get_file() + " - Pixelorama " + Global.current_version
|
||||
|
||||
# Set last opened project path and save
|
||||
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
|
||||
Global.config_cache.set_value("data", "last_project_path", path)
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
if !project.was_exported:
|
||||
|
|
|
@ -217,12 +217,11 @@ func change_project() -> void:
|
|||
if has_changed:
|
||||
Global.main_window.title = Global.main_window.title + "(*)"
|
||||
|
||||
var save_path := OpenSave.current_save_paths[Global.current_project_index]
|
||||
if save_path != "":
|
||||
Global.open_sprites_dialog.current_path = save_path
|
||||
Global.save_sprites_dialog.current_path = save_path
|
||||
if export_directory_path != "":
|
||||
Global.open_sprites_dialog.current_path = export_directory_path
|
||||
Global.save_sprites_dialog.current_path = export_directory_path
|
||||
Global.top_menu_container.file_menu.set_item_text(
|
||||
Global.FileMenu.SAVE, tr("Save") + " %s" % save_path.get_file()
|
||||
Global.FileMenu.SAVE, tr("Save") + " %s" % file_name
|
||||
)
|
||||
else:
|
||||
Global.top_menu_container.file_menu.set_item_text(Global.FileMenu.SAVE, tr("Save"))
|
||||
|
@ -347,7 +346,6 @@ func serialize() -> Dictionary:
|
|||
"brushes": brush_data,
|
||||
"reference_images": reference_image_data,
|
||||
"vanishing_points": vanishing_points,
|
||||
"export_directory_path": export_directory_path,
|
||||
"export_file_name": file_name,
|
||||
"export_file_format": file_format,
|
||||
"fps": fps,
|
||||
|
@ -466,8 +464,6 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces
|
|||
x_symmetry_axis.points[point].y = floorf(y_symmetry_point / 2 + 1)
|
||||
for point in y_symmetry_axis.points.size():
|
||||
y_symmetry_axis.points[point].x = floorf(x_symmetry_point / 2 + 1)
|
||||
if dict.has("export_directory_path"):
|
||||
export_directory_path = dict.export_directory_path
|
||||
if dict.has("export_file_name"):
|
||||
file_name = dict.export_file_name
|
||||
if dict.has("export_file_format"):
|
||||
|
|
|
@ -263,10 +263,6 @@ func load_recent_project_file(path: String) -> void:
|
|||
# Check if file still exists on disk
|
||||
if FileAccess.file_exists(path): # If yes then load the file
|
||||
OpenSave.handle_loading_file(path)
|
||||
# Sync file dialogs
|
||||
Global.save_sprites_dialog.current_dir = path.get_base_dir()
|
||||
Global.open_sprites_dialog.current_dir = path.get_base_dir()
|
||||
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
|
||||
else:
|
||||
# If file doesn't exist on disk then warn user about this
|
||||
Global.popup_error("Cannot find project file.")
|
||||
|
@ -276,7 +272,6 @@ func _on_OpenSprite_files_selected(paths: PackedStringArray) -> void:
|
|||
for path in paths:
|
||||
OpenSave.handle_loading_file(path)
|
||||
Global.save_sprites_dialog.current_dir = paths[0].get_base_dir()
|
||||
Global.config_cache.set_value("data", "current_dir", paths[0].get_base_dir())
|
||||
|
||||
|
||||
func show_save_dialog(project := Global.current_project) -> void:
|
||||
|
@ -311,7 +306,6 @@ func save_project(path: String) -> void:
|
|||
var success := OpenSave.save_pxo_file(path, false, include_blended, project_to_save)
|
||||
if success:
|
||||
Global.open_sprites_dialog.current_dir = path.get_base_dir()
|
||||
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
|
||||
if is_quitting_on_save:
|
||||
changed_projects_on_quit.pop_front()
|
||||
_save_on_quit_confirmation()
|
||||
|
|
Loading…
Reference in a new issue