Fix T48387: Mirror weights keeps groups assigned

Swapping the weights kept zero weight verts assigned.
This commit is contained in:
Campbell Barton 2016-05-11 01:32:26 +10:00
parent e525a06800
commit c1e4aaa289
Notes: blender-bot 2023-02-14 11:35:46 +01:00
Referenced by issue #48387, Mirror vertex group can't work normally in the edit mode
1 changed files with 11 additions and 6 deletions

View File

@ -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);
}
}
}