From 8f39604d047eb6f4a3bb6d5ec8db31d6d2a006ee Mon Sep 17 00:00:00 2001 From: Russell Matney Date: Wed, 11 Oct 2023 09:53:03 -0400 Subject: [PATCH] feat: support dragging resources to the resource-picker (#148) Co-authored-by: miguel --- .../ui/components/resource_picker/resource_picker.gd | 10 ++++++++++ .../ui/components/resource_picker/resource_picker.tscn | 1 + 2 files changed, 11 insertions(+) diff --git a/addons/pandora/ui/components/resource_picker/resource_picker.gd b/addons/pandora/ui/components/resource_picker/resource_picker.gd index 110d3a69..6be79741 100644 --- a/addons/pandora/ui/components/resource_picker/resource_picker.gd +++ b/addons/pandora/ui/components/resource_picker/resource_picker.gd @@ -34,3 +34,13 @@ func _path_changed(new_path:String) -> void: resource_changed.emit(new_path) else: line_edit.text = resource_path + +func _can_drop_data(_pos, data): + if data.type == "files": + return true + return false + +func _drop_data(_pos, data): + if data.type == "files": + var path = data.files[0] + _path_changed(path) diff --git a/addons/pandora/ui/components/resource_picker/resource_picker.tscn b/addons/pandora/ui/components/resource_picker/resource_picker.tscn index b2ce5844..353210bd 100644 --- a/addons/pandora/ui/components/resource_picker/resource_picker.tscn +++ b/addons/pandora/ui/components/resource_picker/resource_picker.tscn @@ -11,6 +11,7 @@ script = ExtResource("1_hjkiw") [node name="LineEdit" type="LineEdit" parent="."] layout_mode = 2 size_flags_horizontal = 3 +mouse_filter = 1 [node name="LoadFileButton" type="Button" parent="."] layout_mode = 2