Allow to attach script when there's no 'selected node', but selection exists
This commit is contained in:
parent
45e7306b5a
commit
63a2475f0f
1 changed files with 5 additions and 1 deletions
|
@ -336,9 +336,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
} break;
|
} break;
|
||||||
case TOOL_ATTACH_SCRIPT: {
|
case TOOL_ATTACH_SCRIPT: {
|
||||||
|
|
||||||
|
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||||
|
if (selection.empty())
|
||||||
|
break;
|
||||||
|
|
||||||
Node *selected = scene_tree->get_selected();
|
Node *selected = scene_tree->get_selected();
|
||||||
if (!selected)
|
if (!selected)
|
||||||
break;
|
selected = selection.front()->get();
|
||||||
|
|
||||||
Ref<Script> existing = selected->get_script();
|
Ref<Script> existing = selected->get_script();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue