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:
parent
ed5449bb66
commit
dcd93b4366
|
@ -641,10 +641,6 @@ var cel_button_scene: PackedScene = load("res://src/UI/Timeline/CelButton.tscn")
|
||||||
## The patterns popup dialog used to display patterns
|
## The patterns popup dialog used to display patterns
|
||||||
## It has the [param PatternsPopup.gd] script attached.
|
## It has the [param PatternsPopup.gd] script attached.
|
||||||
@onready var patterns_popup: Popup = control.find_child("PatternsPopup")
|
@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.
|
## Dialog used to export images. It has the [param ExportDialog.gd] script attached.
|
||||||
@onready var export_dialog: AcceptDialog = control.find_child("ExportDialog")
|
@onready var export_dialog: AcceptDialog = control.find_child("ExportDialog")
|
||||||
## An error dialog to show errors.
|
## An error dialog to show errors.
|
||||||
|
|
|
@ -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
|
# Loading a backup should not change window title and save path
|
||||||
new_project.save_path = path
|
new_project.save_path = path
|
||||||
get_window().title = new_project.name + " - Pixelorama " + Global.current_version
|
get_window().title = new_project.name + " - Pixelorama " + Global.current_version
|
||||||
Global.save_sprites_dialog.current_path = path
|
|
||||||
# Set last opened project path and save
|
# 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", "current_dir", path.get_base_dir())
|
||||||
Global.config_cache.set_value("data", "last_project_path", path)
|
Global.config_cache.set_value("data", "last_project_path", path)
|
||||||
|
|
|
@ -203,9 +203,6 @@ func change_project() -> void:
|
||||||
Global.get_window().title = "%s - Pixelorama %s" % [name, Global.current_version]
|
Global.get_window().title = "%s - Pixelorama %s" % [name, Global.current_version]
|
||||||
if has_changed:
|
if has_changed:
|
||||||
Global.get_window().title = Global.get_window().title + "(*)"
|
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()
|
selection_map_changed()
|
||||||
|
|
||||||
|
|
||||||
|
|
14
src/Main.gd
14
src/Main.gd
|
@ -18,6 +18,9 @@ var splash_dialog: AcceptDialog:
|
||||||
|
|
||||||
@onready var main_ui := $MenuAndUI/UI/DockableContainer as DockableContainer
|
@onready var main_ui := $MenuAndUI/UI/DockableContainer as DockableContainer
|
||||||
@onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
|
@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_dialog := $Dialogs/SaveSprite as FileDialog
|
||||||
@onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5
|
@onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5
|
||||||
@onready var tile_mode_offsets_dialog: ConfirmationDialog = $Dialogs/TileModeOffsetsDialog
|
@onready var tile_mode_offsets_dialog: ConfirmationDialog = $Dialogs/TileModeOffsetsDialog
|
||||||
|
@ -157,6 +160,7 @@ some useful [SYSTEM OPTIONS] are:
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
|
Global.project_switched.connect(_project_switched)
|
||||||
if not DirAccess.dir_exists_absolute("user://backups"):
|
if not DirAccess.dir_exists_absolute("user://backups"):
|
||||||
DirAccess.make_dir_recursive_absolute("user://backups")
|
DirAccess.make_dir_recursive_absolute("user://backups")
|
||||||
Global.shrink = _get_auto_display_scale()
|
Global.shrink = _get_auto_display_scale()
|
||||||
|
@ -177,7 +181,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
quit_and_save_dialog.add_button("Exit without saving", false, "ExitWithoutSaving")
|
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)
|
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
||||||
)
|
)
|
||||||
save_sprite_dialog.current_dir = Global.config_cache.get_value(
|
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()
|
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
|
# Taken from https://github.com/godotengine/godot/blob/3.x/editor/editor_settings.cpp#L1474
|
||||||
func _get_auto_display_scale() -> float:
|
func _get_auto_display_scale() -> float:
|
||||||
if OS.get_name() == "macOS":
|
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)
|
var success := OpenSave.save_pxo_file(path, false, include_blended, project_to_save)
|
||||||
if success:
|
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:
|
if is_quitting_on_save:
|
||||||
changed_projects_on_quit.pop_front()
|
changed_projects_on_quit.pop_front()
|
||||||
_save_on_quit_confirmation()
|
_save_on_quit_confirmation()
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends Panel
|
||||||
signal animation_started(forward: bool)
|
signal animation_started(forward: bool)
|
||||||
signal animation_finished
|
signal animation_finished
|
||||||
|
|
||||||
enum LoopType {NO, CYCLE, PINGPONG}
|
enum LoopType { NO, CYCLE, PINGPONG }
|
||||||
|
|
||||||
const FRAME_BUTTON_TSCN := preload("res://src/UI/Timeline/FrameButton.tscn")
|
const FRAME_BUTTON_TSCN := preload("res://src/UI/Timeline/FrameButton.tscn")
|
||||||
const LAYER_FX_SCENE_PATH := "res://src/UI/Timeline/LayerEffects/LayerEffectsSettings.tscn"
|
const LAYER_FX_SCENE_PATH := "res://src/UI/Timeline/LayerEffects/LayerEffectsSettings.tscn"
|
||||||
|
|
|
@ -535,7 +535,7 @@ func _open_project_file() -> void:
|
||||||
if OS.get_name() == "Web":
|
if OS.get_name() == "Web":
|
||||||
Html5FileExchange.load_image()
|
Html5FileExchange.load_image()
|
||||||
else:
|
else:
|
||||||
_popup_dialog(Global.open_sprites_dialog)
|
_popup_dialog(Global.control.open_sprite_dialog)
|
||||||
Global.control.opensprite_file_selected = false
|
Global.control.opensprite_file_selected = false
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue