Skip to content

Commit

Permalink
feat: support dragging resources to the resource-picker
Browse files Browse the repository at this point in the history
This extends the resource-picker to support a simple drag-and-drop from
the FileSystem tab.

The resource_picker's line_edit's MouseFilter was set to 'pass' so the
drag/drop input could live on the resource_picker itself, which was a
bit simpler than extending a custom LineEdit component.
  • Loading branch information
russmatney committed Oct 10, 2023
1 parent 56f1c54 commit 1e2158d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addons/pandora/ui/components/resource_picker/resource_picker.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1e2158d

Please sign in to comment.