From 587e896daf43ecb9739697d3b38e242948399227 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 10 Sep 2023 22:24:52 +0200 Subject: [PATCH] Fix drag and drop for custom script exported resource classes. --- editor/editor_resource_picker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 38b5bb242..a3789dc0a 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -635,7 +635,10 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const { String file = files[0]; String file_type = EditorFileSystem::get_singleton()->get_file_type(file); - if (file_type != "" && _is_type_valid(file_type, allowed_types)) { + String script_type = EditorNode::get_editor_data().type_get_from_anonymous_path(file); + String class_name = script_type.empty() ? file_type : script_type; + + if (class_name != "" && _is_type_valid(class_name, allowed_types)) { return true; } }