diff options
author | Germano Cavalcante <mano-wii> | 2021-12-29 18:27:24 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-12-29 18:36:58 +0300 |
commit | 1c7d7c915063c7f7c6c960aa843a33f3716debbe (patch) | |
tree | 9cf02bdd335c330691c81f59ba37afe47252c334 /source/blender/blenkernel/intern/object.cc | |
parent | d786b48aab5a38177857e4fe48de5024bfb846ce (diff) |
Fix T94113: Local view + Geometry Nodes is broken for instances
`GeometrySet::compute_boundbox_without_instances` may not initialize min
max in some cases such as meshes without vertices.
This can result in a Bounding Box with impossible dimensions
(min=FLT_MAX, max=-FLT_MAX).
So repeat the same solution seen in `BKE_object_boundbox_calc_from_mesh`
and set boundbox values to zero.
Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13664
Diffstat (limited to 'source/blender/blenkernel/intern/object.cc')
-rw-r--r-- | source/blender/blenkernel/intern/object.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index d08ea74d2c6..5045851d7f9 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -3918,11 +3918,15 @@ bool BKE_object_boundbox_calc_from_evaluated_geometry(Object *ob) INIT_MINMAX(min, max); if (ob->runtime.geometry_set_eval) { - ob->runtime.geometry_set_eval->compute_boundbox_without_instances(&min, &max); + if (!ob->runtime.geometry_set_eval->compute_boundbox_without_instances(&min, &max)) { + zero_v3(min); + zero_v3(max); + } } else if (const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob)) { if (!BKE_mesh_wrapper_minmax(mesh_eval, min, max)) { - return false; + zero_v3(min); + zero_v3(max); } } else if (ob->runtime.curve_cache) { |