[Bf-blender-cvs] [0da1fc2fc41] master: Fix T84029: Point Distribution node crash on mesh with no faces

Hans Goudey noreply at git.blender.org
Fri Jan 1 00:01:49 CET 2021


Commit: 0da1fc2fc4173e8d2f4b694d8996a7873c0b1ea3
Author: Hans Goudey
Date:   Thu Dec 31 17:01:09 2020 -0600
Branches: master
https://developer.blender.org/rB0da1fc2fc4173e8d2f4b694d8996a7873c0b1ea3

Fix T84029: Point Distribution node crash on mesh with no faces

This bug exposes some ugliness in the implementation in poisson disk
distribution implementation with likely incorrect resizing of vectors and
some other assumptions. However, a simple quick fix is to return early
when the input mesh has no faces. This makes sense anyway because
there is no surface to scatter on.

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 1d3fbae5b2e..3c9ad127e8b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -278,6 +278,11 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
   const MeshComponent &mesh_component = *geometry_set.get_component_for_read<MeshComponent>();
   const Mesh *mesh_in = mesh_component.get_for_read();
 
+  if (mesh_in == nullptr || mesh_in->mpoly == nullptr) {
+    params.set_output("Geometry", std::move(geometry_set_out));
+    return;
+  }
+
   const FloatReadAttribute density_factors = mesh_component.attribute_get_for_read<float>(
       density_attribute, ATTR_DOMAIN_POINT, 1.0f);
   const int seed = params.get_input<int>("Seed");



More information about the Bf-blender-cvs mailing list