Fix: Knife tool does not interpolate vertex customdata in interior cuts #107367

1 changed files with 6 additions and 0 deletions
Showing only changes of commit 7e19d7570a - Show all commits

View File

@ -575,6 +575,7 @@ bool BM_face_split_edgenet(BMesh *bm,
/* See: #BM_loop_interp_from_face for similar logic. */
void **blocks = BLI_array_alloca(blocks, f->len);
void **vblocks = BLI_array_alloca(blocks, f->len);
float(*cos_2d)[2] = BLI_array_alloca(cos_2d, f->len);

Prefer void **blocks = has_interp_ldata ? BLI_array_alloca(blocks, f->len) : NULL; - uses less space & doesn't leave unassigned.

Prefer `void **blocks = has_interp_ldata ? BLI_array_alloca(blocks, f->len) : NULL;` - uses less space & doesn't leave unassigned.
float *w = BLI_array_alloca(w, f->len);
float axis_mat[3][3];
@ -598,6 +599,7 @@ bool BM_face_split_edgenet(BMesh *bm,
mul_v2_m3v3(cos_2d[i], axis_mat, l_iter->v->co);
blocks[i] = l_iter->head.data;
vblocks[i] = l_iter->v->head.data;
} while ((void)i++, (l_iter = l_iter->next) != l_first);
@ -618,11 +620,15 @@ bool BM_face_split_edgenet(BMesh *bm,
interp_weights_poly_v2(w, cos_2d, f->len, co);
CustomData_bmesh_interp(
&bm->ldata, (const void **)blocks, w, NULL, f->len, l_iter->head.data);
CustomData_bmesh_interp(

Looks like this could use liter->v->head.data here instead of requiring the separate vblocks array?

Looks like this could use `liter->v->head.data` here instead of requiring the separate `vblocks` array?

The vblocks array is needed as a source each vertices custom data as they're not contiguous as with Mesh custom-data.

The `vblocks` array is needed as a source each vertices custom data as they're not contiguous as with Mesh custom-data.

Ah of course, my bad, thanks.

Ah of course, my bad, thanks.
&bm->vdata, (const void **)vblocks, w, NULL, f->len, l_iter->v->head.data);
l_first = l_iter;
}
else {
CustomData_bmesh_copy_data(
&bm->ldata, &bm->ldata, l_first->head.data, &l_iter->head.data);
CustomData_bmesh_copy_data(
&bm->vdata, &bm->vdata, l_first->v->head.data, &l_iter->v->head.data);
}
}
}