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.
This commit is contained in:
Hans Goudey 2021-07-20 15:56:36 -04:00
parent d3445496b1
commit bfe6b55aa7
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #89827, Geometry Nodes - Attribute Transfer node crash when using "Nearest" mapping.
1 changed files with 6 additions and 4 deletions

View File

@ -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: {