Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-01-01 02:01:09 +0300
committerHans Goudey <h.goudey@me.com>2021-01-01 02:01:29 +0300
commit0da1fc2fc4173e8d2f4b694d8996a7873c0b1ea3 (patch)
tree3e11d565146c421dce6e3a6c33355b2a8370ae99
parentcda897900564740cf52382161fabb44d32eb555d (diff)
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.
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc5
1 files changed, 5 insertions, 0 deletions
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");