From c1e4aaa289f64748093d4cd7590f5836b8873466 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 May 2016 01:32:26 +1000 Subject: [PATCH] Fix T48387: Mirror weights keeps groups assigned Swapping the weights kept zero weight verts assigned. --- source/blender/editors/object/object_vgroup.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index bf626aa1af9..414cc476be5 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2096,14 +2096,19 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr, MDeformWeight *dw = defvert_find_index(dvert, act_vgroup); MDeformWeight *dw_mirr = defvert_find_index(dvert_mirr, act_vgroup); - if (dw || dw_mirr) { - if (dw_mirr == NULL) - dw_mirr = defvert_verify_index(dvert_mirr, act_vgroup); - if (dw == NULL) - dw = defvert_verify_index(dvert, act_vgroup); - + if (dw && dw_mirr) { SWAP(float, dw->weight, dw_mirr->weight); } + else if (dw) { + dw_mirr = defvert_verify_index(dvert_mirr, act_vgroup); + dw_mirr->weight = dw->weight; + defvert_remove_group(dvert, dw); + } + else if (dw_mirr) { + dw = defvert_verify_index(dvert, act_vgroup); + dw->weight = dw_mirr->weight; + defvert_remove_group(dvert_mirr, dw_mirr); + } } }