From 1c7d7c915063c7f7c6c960aa843a33f3716debbe Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Wed, 29 Dec 2021 12:27:24 -0300 Subject: 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 --- source/blender/blenkernel/intern/pointcloud.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/pointcloud.cc') diff --git a/source/blender/blenkernel/intern/pointcloud.cc b/source/blender/blenkernel/intern/pointcloud.cc index 82dde79cff6..35043edb3a3 100644 --- a/source/blender/blenkernel/intern/pointcloud.cc +++ b/source/blender/blenkernel/intern/pointcloud.cc @@ -261,8 +261,12 @@ PointCloud *BKE_pointcloud_new_nomain(const int totpoint) return pointcloud; } -void BKE_pointcloud_minmax(const struct PointCloud *pointcloud, float r_min[3], float r_max[3]) +bool BKE_pointcloud_minmax(const struct PointCloud *pointcloud, float r_min[3], float r_max[3]) { + if (!pointcloud->totpoint) { + return false; + } + float(*pointcloud_co)[3] = pointcloud->co; float *pointcloud_radius = pointcloud->radius; for (int a = 0; a < pointcloud->totpoint; a++) { @@ -273,6 +277,7 @@ void BKE_pointcloud_minmax(const struct PointCloud *pointcloud, float r_min[3], DO_MIN(co_min, r_min); DO_MAX(co_max, r_max); } + return true; } BoundBox *BKE_pointcloud_boundbox_get(Object *ob) -- cgit v1.2.3