From f7cc9a8104b1df7076eb5df4a98fe3ccdba3a92d Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 17 Jun 2020 03:56:46 +0300 Subject: [PATCH] Added ability to import images as palettes --- src/Autoload/OpenSave.gd | 1 + src/UI/Dialogs/PreviewDialog.gd | 2 ++ src/UI/Dialogs/PreviewDialog.tscn | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Autoload/OpenSave.gd b/src/Autoload/OpenSave.gd index 5a6f4ee..31ef7ce 100644 --- a/src/Autoload/OpenSave.gd +++ b/src/Autoload/OpenSave.gd @@ -19,6 +19,7 @@ func _ready() -> void: func handle_loading_files(files : PoolStringArray) -> void: for file in files: + file = file.replace("\\", "/") if file.get_extension().to_lower() == "pxo": open_pxo_file(file) else: diff --git a/src/UI/Dialogs/PreviewDialog.gd b/src/UI/Dialogs/PreviewDialog.gd index 1c92eec..530eddf 100644 --- a/src/UI/Dialogs/PreviewDialog.gd +++ b/src/UI/Dialogs/PreviewDialog.gd @@ -38,6 +38,8 @@ func _on_PreviewDialog_confirmed() -> void: OpenSave.open_image_as_new_tab(path, image) elif current_import_option == ImageImportOptions.SPRITESHEET: OpenSave.open_image_as_spritesheet(path, image, spritesheet_horizontal, spritesheet_vertical) + elif current_import_option == ImageImportOptions.PALETTE: + Global.palette_container.on_palette_import_file_selected(path) func _on_ImportOption_item_selected(id : int) -> void: diff --git a/src/UI/Dialogs/PreviewDialog.tscn b/src/UI/Dialogs/PreviewDialog.tscn index 8ebde6a..a3889a4 100644 --- a/src/UI/Dialogs/PreviewDialog.tscn +++ b/src/UI/Dialogs/PreviewDialog.tscn @@ -63,7 +63,7 @@ margin_right = 151.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 text = "New tab" -items = [ "New tab", null, false, 0, null, "Spritesheet (new tab)", null, false, 1, null, "New frame", null, true, 2, null, "New layer", null, true, 3, null, "New palette", null, true, 4, null ] +items = [ "New tab", null, false, 0, null, "Spritesheet (new tab)", null, false, 1, null, "New frame", null, true, 2, null, "New layer", null, true, 3, null, "New palette", null, false, 4, null ] selected = 0 [node name="SpritesheetOptions" type="HBoxContainer" parent="VBoxContainer/HBoxContainer"]