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.
This commit is contained in:
Hans Goudey 2020-12-31 17:01:09 -06:00
parent cda8979005
commit 0da1fc2fc4
Notes: blender-bot 2023-02-14 08:10:10 +01:00
Referenced by issue #84324, Blender crashes during composited scenes rendering
Referenced by issue #84029, Geometry Nodes: Crash using Poisson Disk Point Distribution on mesh with no faces
Referenced by issue #83925, Crash when rendering with OptiX denoiser enabled
1 changed files with 5 additions and 0 deletions

View File

@ -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");