Mesh Edit: implement X symmetry in the Blend From Shape operator.

This symmetrizes selection and vertex positions like any other operator.

Pull Request #105421
This commit is contained in:
Alexander Gavrilov
2023-02-04 18:26:46 +02:00
parent 308da08221
commit 0bd95dd963

View File

@@ -3853,6 +3853,14 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
shape = BLI_findindex(&key->block, kb);
if (kb) {
const bool use_symmetry = (me->symmetry & ME_SYMMETRY_X) != 0;
if (use_symmetry) {
const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
EDBM_verts_mirror_cache_begin(em, 0, false, true, false, use_topology);
}
/* Perform blending on selected vertices. */
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_SELECT) || BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
@@ -3877,6 +3885,12 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
interp_v3_v3v3(eve->co, eve->co, co, blend);
}
}
if (use_symmetry) {
EDBM_verts_mirror_apply(em, BM_ELEM_SELECT, 0);
EDBM_verts_mirror_cache_end(em);
}
EDBMUpdate_Params params{};
params.calc_looptri = true;
params.calc_normals = true;