Merge pull request #49521 from LightningAA/focus-scenetree-on-root-node-4.0

Focus the scene tree dock after hitting one of the "Create Root Node:" buttons
This commit is contained in:
Rémi Verschelde 2021-08-12 08:13:01 +02:00 committed by GitHub
commit d64343911c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1143,6 +1143,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_selection->clear(); editor_selection->clear();
editor_selection->add_node(new_node); editor_selection->add_node(new_node);
scene_tree->get_scene_tree()->grab_focus();
} break; } break;
default: { default: {
@ -2279,7 +2280,7 @@ void SceneTreeDock::_create() {
_do_reparent(last_created, -1, nodes, true); _do_reparent(last_created, -1, nodes, true);
} }
scene_tree->get_scene_tree()->call_deferred(SNAME("grab_focus")); scene_tree->get_scene_tree()->grab_focus();
} }
void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_properties, bool p_remove_old) { void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_properties, bool p_remove_old) {