From e2934a04e2e0da88c8e4af2f0c1b9029513fc462 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. (cherry picked from commit fc055e199328b9ff55535862af2e5fab96be82b5) --- editor/plugins/canvas_item_editor_plugin.cpp | 1 - editor/plugins/spatial_editor_plugin.cpp | 3 --- 2 files changed, 4 deletions(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 9ae87198f42..ca7c30be1bd 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5159,7 +5159,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) { diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 1af548a149b..0f152b08621 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3473,9 +3473,6 @@ void SpatialEditorViewport::reset() { } void SpatialEditorViewport::focus_selection() { - if (!get_selected_count()) - return; - Vector3 center; int count = 0;