diff options
author | Tomasz Chabora <kobewi4e@gmail.com> | 2019-03-05 16:25:05 +0100 |
---|---|---|
committer | Tomasz Chabora <kobewi4e@gmail.com> | 2019-03-05 16:28:39 +0100 |
commit | 63a2475f0fa5ad13e86d61feca33bc3e6c9ef108 (patch) | |
tree | 89bb7b59695e5cd547139e15424d5a1ac13f47a9 | |
parent | 45e7306b5adec09746fefda902a5414e5b53fdfa (diff) |
Allow to attach script when there's no 'selected node', but selection exists
-rw-r--r-- | editor/scene_tree_dock.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index d931d5bb37..084830ed7b 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<Node *> 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<Script> existing = selected->get_script(); |