From 63a2475f0fa5ad13e86d61feca33bc3e6c9ef108 Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Tue, 5 Mar 2019 16:25:05 +0100 Subject: [PATCH] Allow to attach script when there's no 'selected node', but selection exists --- editor/scene_tree_dock.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index d931d5bb378..084830ed7bd 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -336,9 +336,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } break; case TOOL_ATTACH_SCRIPT: { + List selection = editor_selection->get_selected_node_list(); + if (selection.empty()) + break; + Node *selected = scene_tree->get_selected(); if (!selected) - break; + selected = selection.front()->get(); Ref