[Bf-blender-cvs] [bfe6b55aa70] master: Fix T89827: Attribute transfer node crash on mesh with no faces

Hans Goudey noreply at git.blender.org
Tue Jul 20 21:56:41 CEST 2021


Commit: bfe6b55aa706ac5952bd6e887a6e3bfec86de74f
Author: Hans Goudey
Date:   Tue Jul 20 15:56:36 2021 -0400
Branches: master
https://developer.blender.org/rBbfe6b55aa706ac5952bd6e887a6e3bfec86de74f

Fix T89827: Attribute transfer node crash on mesh with no faces

Just add a check for whether the mesh has faces when retrieving an
attribute on the corner domain. In the future there could be an info
message in the node in this case, since maybe it's not intuitive.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc

===================================================================

diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc
index 756f93f154f..6a23443d3ab 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc
@@ -370,10 +370,12 @@ static void transfer_attribute_nearest(const GeometrySet &src_geometry,
           break;
         }
         case ATTR_DOMAIN_CORNER: {
-          use_mesh = true;
-          mesh_indices.reinitialize(tot_samples);
-          mesh_distances_sq.reinitialize(tot_samples);
-          get_closest_mesh_corners(*mesh, dst_positions, mesh_indices, mesh_distances_sq, {});
+          if (mesh->totloop > 0) {
+            use_mesh = true;
+            mesh_indices.reinitialize(tot_samples);
+            mesh_distances_sq.reinitialize(tot_samples);
+            get_closest_mesh_corners(*mesh, dst_positions, mesh_indices, mesh_distances_sq, {});
+          }
           break;
         }
         default: {



More information about the Bf-blender-cvs mailing list