Allow to attach script when there's no 'selected node', but selection exists

This commit is contained in:
Tomasz Chabora 2019-03-05 16:25:05 +01:00
parent 45e7306b5a
commit 63a2475f0f

View file

@ -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();