Drag and drop palette files to open them

This commit is contained in:
OverloadedOrama 2020-06-17 16:47:24 +03:00
parent f7cc9a8104
commit 25d9aca0c4
4 changed files with 11 additions and 7 deletions

View file

@ -20,9 +20,12 @@ func _ready() -> void:
func handle_loading_files(files : PoolStringArray) -> void:
for file in files:
file = file.replace("\\", "/")
if file.get_extension().to_lower() == "pxo":
var file_ext : String = file.get_extension().to_lower()
if file_ext == "pxo": # Pixelorama project file
open_pxo_file(file)
else:
elif file_ext == "json" or file_ext == "gpl": # Palettes
Global.palette_container.on_palette_import_file_selected(file)
else: # Image files
var image := Image.new()
var err := image.load(file)
if err != OK: # An error occured