From fc055e199328b9ff55535862af2e5fab96be82b5 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 4 Apr 2021 19:58:46 +0200 Subject: [PATCH] Allow Center Selection to work without any selection in 2D/3D editors When there is no selection, the camera will center around the world origin. This helps people get back to the world center if they haven't added any nodes yet. --- editor/plugins/canvas_item_editor_plugin.cpp | 3 --- editor/plugins/node_3d_editor_plugin.cpp | 4 ---- 2 files changed, 7 deletions(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d4e06aa9caf..40a2502d9f8 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5376,9 +5376,6 @@ void CanvasItemEditor::_focus_selection(int p_op) { rect = rect.merge(canvas_item_rect); } }; - if (count == 0) { - return; - } if (p_op == VIEW_CENTER_TO_SELECTION) { center = rect.position + rect.size / 2; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 81c59fc0a93..d729f2fafdb 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3545,10 +3545,6 @@ void Node3DEditorViewport::reset() { } void Node3DEditorViewport::focus_selection() { - if (!get_selected_count()) { - return; - } - Vector3 center; int count = 0;