1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-13 09:13:07 +00:00

Always open the import dialog when opening images from File > Open

This commit is contained in:
Emmanouil Papadeas 2025-02-09 20:39:12 +02:00
parent 0ae1cb3f0f
commit c7c79f9203
2 changed files with 9 additions and 5 deletions

View file

@ -25,7 +25,7 @@ func _ready() -> void:
update_autosave()
func handle_loading_file(file: String) -> void:
func handle_loading_file(file: String, force_import_dialog_on_images := false) -> void:
file = file.replace("\\", "/")
var file_ext := file.get_extension().to_lower()
if file_ext == "pxo": # Pixelorama project file
@ -74,7 +74,7 @@ func handle_loading_file(file: String) -> void:
var file_name: String = file.get_file()
Global.popup_error(tr("Can't load file '%s'.") % [file_name])
return
handle_loading_image(file, image)
handle_loading_image(file, image, force_import_dialog_on_images)
func add_import_option(import_name: StringName, import_scene: PackedScene) -> int:
@ -118,8 +118,12 @@ func load_image_from_buffer(buffer: PackedByteArray) -> Image:
return image
func handle_loading_image(file: String, image: Image) -> void:
if Global.projects.size() <= 1 and Global.current_project.is_empty():
func handle_loading_image(file: String, image: Image, force_import_dialog := false) -> void:
if (
Global.projects.size() <= 1
and Global.current_project.is_empty()
and not force_import_dialog
):
open_image_as_new_tab(file, image)
return
var preview_dialog := preview_dialog_tscn.instantiate() as ImportPreviewDialog

View file

@ -443,7 +443,7 @@ func load_recent_project_file(path: String) -> void:
func _on_OpenSprite_files_selected(paths: PackedStringArray) -> void:
for path in paths:
OpenSave.handle_loading_file(path)
OpenSave.handle_loading_file(path, true)
save_sprite_dialog.current_dir = paths[0].get_base_dir()