1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Remove unnecessary casts

button_add_item and button_add are both Button

p_parent is a Node3D

CanvasItem can never be cast to Viewport
This commit is contained in:
Markus Sauermann
2022-10-24 15:59:18 +02:00
parent 040f49ed6e
commit 5ee449efec
4 changed files with 7 additions and 11 deletions

View File

@@ -3781,7 +3781,7 @@ AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, boo
if (child) {
AABB child_bounds = _calculate_spatial_bounds(child, false);
if (bounds.size == Vector3() && Object::cast_to<Node3D>(p_parent)) {
if (bounds.size == Vector3() && p_parent) {
bounds = child_bounds;
} else {
bounds.merge_with(child_bounds);
@@ -3789,7 +3789,7 @@ AABB Node3DEditorViewport::_calculate_spatial_bounds(const Node3D *p_parent, boo
}
}
if (bounds.size == Vector3() && !Object::cast_to<Node3D>(p_parent)) {
if (bounds.size == Vector3() && !p_parent) {
bounds = AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4));
}