Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions editor/scene/3d/node_3d_editor_viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5441,12 +5441,10 @@ void Node3DEditorViewport::focus_aabb() {
float required_distance = 0.0f;

const List<Node *> &selection = editor_selection->get_top_selected_node_list();
if (selection.is_empty()) {
return;
if (!selection.is_empty()) {
focused_node_id = selection.front()->get()->get_instance_id();
}

focused_node_id = selection.front()->get()->get_instance_id();

LocalVector<Node *> stack;
stack.reserve(selection.size());
for (Node *node : selection) {
Expand All @@ -5469,6 +5467,19 @@ void Node3DEditorViewport::focus_aabb() {
combined_aabb = combined_aabb.merge(global_aabb);
}
}
} else {
Node3D *node_3d = Object::cast_to<Node3D>(node);
if (node_3d) {
Vector3 pivot = node_3d->get_global_position();
if (!aabb_valid) {
combined_aabb = AABB(pivot, Vector3());
aabb_valid = true;
} else {
combined_aabb.expand_to(pivot);
}
} else {
continue;
}
}

for (Node *child : node->iterate_children()) {
Expand Down