From ae89d3e2913e91b4908ddd7a8824264305565abc Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 29 May 2020 20:19:22 +0300 Subject: [PATCH] Connected "files_dropped" signal to a method This lets the user drag and drop files into Pixelorama, while it runs, to open them. This doesn't work properly and will crash when it can't open the files. It will get merged into master soon. --- src/Main.gd | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Main.gd b/src/Main.gd index 473430109..1f37c9e3b 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -41,6 +41,7 @@ func _ready() -> void: handle_backup() handle_running_pixelorama_with_arguments() + get_tree().connect("files_dropped", self, "_on_files_dropped") func _input(event : InputEvent) -> void: @@ -236,6 +237,17 @@ func _notification(what : int) -> void: show_quit_dialog() +func _on_files_dropped(files : PoolStringArray, screen : int) -> void: + for file in files: + if file.get_extension().to_lower() == "pxo": + _on_OpenSprite_file_selected(file) + else: + if file == files[0]: + $ImportSprites.new_frame = false + $ImportSprites._on_ImportSprites_files_selected([file]) + $ImportSprites.new_frame = true + + func on_new_project_file_menu_option_pressed(id : int) -> void: if Global.project_has_changed: unsaved_canvas_state = id