1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Remove Global.open_sprites_dialog and Global.save_sprites_dialog.

This commit is contained in:
Emmanouil Papadeas 2024-10-11 17:12:55 +03:00
parent ed5449bb66
commit dcd93b4366
6 changed files with 14 additions and 12 deletions

View file

@ -641,10 +641,6 @@ var cel_button_scene: PackedScene = load("res://src/UI/Timeline/CelButton.tscn")
## The patterns popup dialog used to display patterns
## It has the [param PatternsPopup.gd] script attached.
@onready var patterns_popup: Popup = control.find_child("PatternsPopup")
## Dialog used to navigate and open images and projects.
@onready var open_sprites_dialog: FileDialog = control.find_child("OpenSprite")
## Dialog used to save (.pxo) projects.
@onready var save_sprites_dialog: FileDialog = control.find_child("SaveSprite")
## Dialog used to export images. It has the [param ExportDialog.gd] script attached.
@onready var export_dialog: AcceptDialog = control.find_child("ExportDialog")
## An error dialog to show errors.

View file

@ -276,7 +276,6 @@ func open_pxo_file(path: String, is_backup := false, replace_empty := true) -> v
# Loading a backup should not change window title and save path
new_project.save_path = path
get_window().title = new_project.name + " - 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)

View file

@ -203,9 +203,6 @@ func change_project() -> void:
Global.get_window().title = "%s - Pixelorama %s" % [name, Global.current_version]
if has_changed:
Global.get_window().title = Global.get_window().title + "(*)"
if export_directory_path != "":
Global.open_sprites_dialog.current_path = export_directory_path
Global.save_sprites_dialog.current_path = export_directory_path
selection_map_changed()

View file

@ -18,6 +18,9 @@ var splash_dialog: AcceptDialog:
@onready var main_ui := $MenuAndUI/UI/DockableContainer as DockableContainer
@onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
## Dialog used to open images and project (.pxo) files.
@onready var open_sprite_dialog := $Dialogs/OpenSprite as FileDialog
## Dialog used to save project (.pxo) files.
@onready var save_sprite_dialog := $Dialogs/SaveSprite as FileDialog
@onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5
@onready var tile_mode_offsets_dialog: ConfirmationDialog = $Dialogs/TileModeOffsetsDialog
@ -157,6 +160,7 @@ some useful [SYSTEM OPTIONS] are:
func _init() -> void:
Global.project_switched.connect(_project_switched)
if not DirAccess.dir_exists_absolute("user://backups"):
DirAccess.make_dir_recursive_absolute("user://backups")
Global.shrink = _get_auto_display_scale()
@ -177,7 +181,7 @@ func _ready() -> void:
quit_and_save_dialog.add_button("Exit without saving", false, "ExitWithoutSaving")
Global.open_sprites_dialog.current_dir = Global.config_cache.get_value(
open_sprite_dialog.current_dir = Global.config_cache.get_value(
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
)
save_sprite_dialog.current_dir = Global.config_cache.get_value(
@ -203,6 +207,12 @@ func _input(event: InputEvent) -> void:
get_viewport().gui_get_focus_owner().release_focus()
func _project_switched() -> void:
if Global.current_project.export_directory_path != "":
open_sprite_dialog.current_path = Global.current_project.export_directory_path
save_sprite_dialog.current_path = Global.current_project.export_directory_path
# Taken from https://github.com/godotengine/godot/blob/3.x/editor/editor_settings.cpp#L1474
func _get_auto_display_scale() -> float:
if OS.get_name() == "macOS":
@ -462,7 +472,7 @@ 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()
open_sprite_dialog.current_dir = path.get_base_dir()
if is_quitting_on_save:
changed_projects_on_quit.pop_front()
_save_on_quit_confirmation()

View file

@ -535,7 +535,7 @@ func _open_project_file() -> void:
if OS.get_name() == "Web":
Html5FileExchange.load_image()
else:
_popup_dialog(Global.open_sprites_dialog)
_popup_dialog(Global.control.open_sprite_dialog)
Global.control.opensprite_file_selected = false