1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

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.
This commit is contained in:
OverloadedOrama 2020-05-29 20:19:22 +03:00
parent 00a0ab882a
commit ae89d3e291

View file

@ -41,6 +41,7 @@ func _ready() -> void:
handle_backup() handle_backup()
handle_running_pixelorama_with_arguments() handle_running_pixelorama_with_arguments()
get_tree().connect("files_dropped", self, "_on_files_dropped")
func _input(event : InputEvent) -> void: func _input(event : InputEvent) -> void:
@ -236,6 +237,17 @@ func _notification(what : int) -> void:
show_quit_dialog() 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: func on_new_project_file_menu_option_pressed(id : int) -> void:
if Global.project_has_changed: if Global.project_has_changed:
unsaved_canvas_state = id unsaved_canvas_state = id