Fix T101882: Division by zero in mesh topology nodes

A vertex might be connected to no edges or no faces. Most of these nodes
worked fine in that case, but we might as well make that explicit
and skip the sorting anyway.
This commit is contained in:
Hans Goudey 2022-10-17 16:51:42 -05:00
parent e8291f4504
commit 161aa5e0d0
Notes: blender-bot 2023-09-13 08:48:34 +02:00
Referenced by issue #101882, Geometry Nodes 3.4 crashes on viewing corners of wire mesh
Referenced by issue #101858, Edge of Vertex + Instance on Points = Error   : EXCEPTION_INT_DIVIDE_BY_ZERO
2 changed files with 8 additions and 0 deletions

View File

@ -93,6 +93,10 @@ class CornersOfVertInput final : public bke::MeshFieldInput {
}
const Span<int> corners = vert_to_loop_map[vert_i];
if (corners.is_empty()) {
corner_of_vertex[selection_i] = 0;
continue;
}
/* Retrieve the connected edge indices as 64 bit integers for #materialize_compressed. */
corner_indices.reinitialize(corners.size());

View File

@ -93,6 +93,10 @@ class EdgesOfVertInput final : public bke::MeshFieldInput {
}
const Span<int> edges = vert_to_edge_map[vert_i];
if (edges.is_empty()) {
edge_of_vertex[selection_i] = 0;
continue;
}
/* Retrieve the connected edge indices as 64 bit integers for #materialize_compressed. */
edge_indices.reinitialize(edges.size());