Fix #120231: Unwrap can crash with shape_method='CONVEX'
There was no check for a convex hull with 1-2 points,
causing unwrap to crash on degenerate faces.
Regression caused by [0] (fix for #115061), which hid this bug.
[0]: 0053de6556
This commit is contained in:
@@ -353,14 +353,15 @@ void PackIsland::finalize_geometry_(const UVPackIsland_Params ¶ms, MemArena
|
||||
|
||||
/* Compute convex hull. */
|
||||
int convex_len = BLI_convexhull_2d(source, vert_count, index_map);
|
||||
|
||||
/* Write back. */
|
||||
triangle_vertices_.clear();
|
||||
Array<float2> convexVertices(convex_len);
|
||||
for (int i = 0; i < convex_len; i++) {
|
||||
convexVertices[i] = source[index_map[i]];
|
||||
if (convex_len >= 3) {
|
||||
/* Write back. */
|
||||
triangle_vertices_.clear();
|
||||
Array<float2> convexVertices(convex_len);
|
||||
for (int i = 0; i < convex_len; i++) {
|
||||
convexVertices[i] = source[index_map[i]];
|
||||
}
|
||||
add_polygon(convexVertices, arena, heap);
|
||||
}
|
||||
add_polygon(convexVertices, arena, heap);
|
||||
|
||||
BLI_heap_clear(heap, nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user