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.
This commit is contained in:
Hugo Locurcio 2021-04-04 19:58:46 +02:00
parent a864a703ee
commit fc055e1993
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
2 changed files with 0 additions and 7 deletions

View File

@ -5376,9 +5376,6 @@ void CanvasItemEditor::_focus_selection(int p_op) {
rect = rect.merge(canvas_item_rect); rect = rect.merge(canvas_item_rect);
} }
}; };
if (count == 0) {
return;
}
if (p_op == VIEW_CENTER_TO_SELECTION) { if (p_op == VIEW_CENTER_TO_SELECTION) {
center = rect.position + rect.size / 2; center = rect.position + rect.size / 2;

View File

@ -3545,10 +3545,6 @@ void Node3DEditorViewport::reset() {
} }
void Node3DEditorViewport::focus_selection() { void Node3DEditorViewport::focus_selection() {
if (!get_selected_count()) {
return;
}
Vector3 center; Vector3 center;
int count = 0; int count = 0;