forked from blender/blender
main sync #3
@ -795,8 +795,6 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> mpoly,
|
|||||||
const int loopstart = mp.loopstart;
|
const int loopstart = mp.loopstart;
|
||||||
const int totloop = mp.totloop;
|
const int totloop = mp.totloop;
|
||||||
|
|
||||||
int vert_ctx_len = 0;
|
|
||||||
|
|
||||||
int prev_wloop_len = wloop_len;
|
int prev_wloop_len = wloop_len;
|
||||||
for (const int i_loop : mloop.index_range().slice(loopstart, totloop)) {
|
for (const int i_loop : mloop.index_range().slice(loopstart, totloop)) {
|
||||||
int v = mloop[i_loop].v;
|
int v = mloop[i_loop].v;
|
||||||
@ -805,9 +803,6 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> mpoly,
|
|||||||
int e_dest = edge_dest_map[e];
|
int e_dest = edge_dest_map[e];
|
||||||
bool is_vert_ctx = v_dest != OUT_OF_CONTEXT;
|
bool is_vert_ctx = v_dest != OUT_OF_CONTEXT;
|
||||||
bool is_edge_ctx = e_dest != OUT_OF_CONTEXT;
|
bool is_edge_ctx = e_dest != OUT_OF_CONTEXT;
|
||||||
if (is_vert_ctx) {
|
|
||||||
vert_ctx_len++;
|
|
||||||
}
|
|
||||||
if (is_vert_ctx || is_edge_ctx) {
|
if (is_vert_ctx || is_edge_ctx) {
|
||||||
WeldLoop wl{};
|
WeldLoop wl{};
|
||||||
wl.vert = is_vert_ctx ? v_dest : v;
|
wl.vert = is_vert_ctx ? v_dest : v;
|
||||||
@ -835,9 +830,11 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> mpoly,
|
|||||||
wpoly.append(wp);
|
wpoly.append(wp);
|
||||||
|
|
||||||
poly_map[i] = wpoly_len++;
|
poly_map[i] = wpoly_len++;
|
||||||
if (totloop > 5 && vert_ctx_len > 1) {
|
if (totloop > 5 && loops_len > 1) {
|
||||||
/* Each untouched vertex pair is a candidate for a new polygon. */
|
/* We could be smarter here and actually count how many new polygons will be created.
|
||||||
int max_new = std::min(vert_ctx_len, (totloop - vert_ctx_len) / 2);
|
* But counting this can be inefficient as it depends on the number of non-consecutive
|
||||||
|
* self polygon merges. For now just estimate a maximum value. */
|
||||||
|
int max_new = std::min((totloop / 3), loops_len) - 1;
|
||||||
maybe_new_poly += max_new;
|
maybe_new_poly += max_new;
|
||||||
CLAMP_MIN(max_ctx_poly_len, totloop);
|
CLAMP_MIN(max_ctx_poly_len, totloop);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user