From aafd71a8a160bdf44ab3ccea37e88bb90b87a2ac Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Sat, 10 Oct 2020 11:13:01 -0300 Subject: Fix T81060: CustomData Correction sometimes breaks UVs and Vertex Colors `CustomData_bmesh_interp` use the same CustomData decryptor (in this case, `bm->ldata`) in both blocks. So make sure that all CustomData layers match. This commit also removes redundant `BM_elem_attrs_copy_ex` calls. Maniphest Tasks: T81060 Differential Revision: https://developer.blender.org/D9159 --- source/blender/editors/transform/transform_convert_mesh.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/transform/transform_convert_mesh.c') diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index d40a7168af1..f154c8d338e 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1176,8 +1176,9 @@ static void mesh_customdatacorrect_init_container_generic(TransDataContainer *UN .use_toolflags = false, })); - /* We need to have matching custom-data. */ - BM_mesh_copy_init_customdata(bm_origfaces, bm, NULL); + /* We need to have matching loop custom-data. */ + BM_mesh_copy_init_customdata_all_layers(bm_origfaces, bm, BM_LOOP, NULL); + tcld->origfaces = origfaces; tcld->bm_origfaces = bm_origfaces; @@ -1359,9 +1360,6 @@ static void mesh_customdatacorrect_apply_vert(struct TransCustomDataLayer *tcld, * and we do not want to mess up other shape keys */ BM_loop_interp_from_face(bm, l, f_copy, false, false); - /* make sure face-attributes are correct (e.g. #MLoopUV, #MLoopCol) */ - BM_elem_attrs_copy_ex(tcld->bm_origfaces, bm, f_copy, l->f, BM_ELEM_SELECT, CD_MASK_NORMAL); - /* weight the loop */ if (do_loop_weight) { const float eps = 1.0e-8f; @@ -1514,8 +1512,6 @@ static void mesh_customdatacorrect_restore(struct TransInfo *t) BM_elem_attrs_copy(bm_copy, bm, l_copy, l_iter); l_copy = l_copy->next; } while ((l_iter = l_iter->next) != l_first); - - BM_elem_attrs_copy_ex(bm_copy, bm, f_copy, f, BM_ELEM_SELECT, CD_MASK_NORMAL); } } } -- cgit v1.2.3