summaryrefslogtreecommitdiff
path: root/editor/editor_properties.cpp
diff options
context:
space:
mode:
authorNolkaloid <noe.le.cam.nlc@gmail.com>2022-07-04 03:23:42 +0200
committerNolkaloid <noe.le.cam.nlc@gmail.com>2022-07-04 20:10:40 +0200
commit31745a8b15443a28b8d8c90d408ebb47913342a1 (patch)
tree081c9058f900e12867a9ea706664d9602043283b /editor/editor_properties.cpp
parentb4644e283556b499a22dada2db5cff12290440ca (diff)
Fix drag'n drop type check for NodePaths
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r--editor/editor_properties.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 70622e85ff..6a035225e5 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -3175,7 +3175,20 @@ bool EditorPropertyNodePath::is_drop_valid(const Dictionary &p_drag_data) const
return false;
}
Array nodes = p_drag_data["nodes"];
- return nodes.size() == 1;
+ if (nodes.size() != 1) {
+ return false;
+ }
+
+ Node *dropped_node = get_tree()->get_edited_scene_root()->get_node(nodes[0]);
+ ERR_FAIL_NULL_V(dropped_node, false);
+
+ for (const StringName &E : valid_types) {
+ if (dropped_node->is_class(E)) {
+ return true;
+ }
+ }
+
+ return false;
}
void EditorPropertyNodePath::update_property() {