diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-04-04 19:58:46 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-04-04 19:58:46 +0200 |
commit | fc055e199328b9ff55535862af2e5fab96be82b5 (patch) | |
tree | dbf20bac70d54fdca452dada9f2620a72896d9d7 | |
parent | a864a703ee27065795c6297aaeb72ed753d0f279 (diff) |
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.
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 4 |
2 files changed, 0 insertions, 7 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d4e06aa9ca..40a2502d9f 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 81c59fc0a9..d729f2fafd 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; |