summaryrefslogtreecommitdiff
path: root/editor/scene_tree_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r--editor/scene_tree_dock.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 2fcba7e3c0..f3e59932c4 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -270,6 +270,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
switch (p_tool) {
case TOOL_NEW: {
+
+ String preferred = "";
+ Node *current_edited_scene_root = EditorNode::get_singleton()->get_edited_scene();
+
+ if (current_edited_scene_root) {
+
+ if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Node2D"))
+ preferred = "Node2D";
+ else if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Spatial"))
+ preferred = "Spatial";
+ }
+ create_dialog->set_preferred_search_result_type(preferred);
create_dialog->popup_create(true);
} break;
case TOOL_INSTANCE: {