Fix #105556: weld modifier crashes when merging N-gons
The logic for counting possible new polygons was incorrect.
This commit is contained in:
@@ -836,9 +836,9 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> mpoly,
|
|||||||
|
|
||||||
poly_map[i] = wpoly_len++;
|
poly_map[i] = wpoly_len++;
|
||||||
if (totloop > 5 && vert_ctx_len > 1) {
|
if (totloop > 5 && vert_ctx_len > 1) {
|
||||||
int max_new = (totloop / 3) - 1;
|
/* Each untouched vertex pair is a candidate for a new polygon. */
|
||||||
vert_ctx_len /= 2;
|
int max_new = std::min(vert_ctx_len, (totloop - vert_ctx_len) / 2);
|
||||||
maybe_new_poly += MIN2(max_new, vert_ctx_len);
|
maybe_new_poly += max_new;
|
||||||
CLAMP_MIN(max_ctx_poly_len, totloop);
|
CLAMP_MIN(max_ctx_poly_len, totloop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user