Fix T98459: vertex weight paste/copy inconsistent
In the editmode sidebar, pasting a particular vertex's weight in a single group was not behaving the same as copying for all groups [in that the former dis not copy to unassigned vertices whereas the later did copy to unassigned vertices]. This behaves like this since the introduction in {rB70fd2320c8d2}, but there does not seem to be a good reason for this? Now make this consistent and use `BKE_defvert_copy_index` in both cases (instead of earlying out if unassigned, this will make sure this will also copy to unassigned). Maniphest Tasks: T98459 Differential Revision: https://developer.blender.org/D15062
This commit is contained in:
parent
16d329da28
commit
4eb5163b18
Notes:
blender-bot
2023-02-13 15:19:56 +01:00
Referenced by issue #98459, Edit mode vertex_weight_paste does not copy to unassigned vertices
|
@ -4266,7 +4266,6 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
|
|||
|
||||
Mesh *me = ob->data;
|
||||
BMEditMesh *em = me->edit_mesh;
|
||||
float weight_act;
|
||||
int i;
|
||||
|
||||
if (em) {
|
||||
|
@ -4278,18 +4277,15 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
|
|||
if (dvert_act == NULL) {
|
||||
return;
|
||||
}
|
||||
weight_act = BKE_defvert_find_weight(dvert_act, def_nr);
|
||||
|
||||
BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
|
||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && (eve != eve_act)) {
|
||||
MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset);
|
||||
MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr);
|
||||
if (dw) {
|
||||
dw->weight = weight_act;
|
||||
MDeformVert *dvert_dst = BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset);
|
||||
|
||||
if (me->symmetry & ME_SYMMETRY_X) {
|
||||
ED_mesh_defvert_mirror_update_em(ob, eve, -1, i, cd_dvert_offset);
|
||||
}
|
||||
BKE_defvert_copy_index(dvert_dst, def_nr, dvert_act, def_nr);
|
||||
|
||||
if (me->symmetry & ME_SYMMETRY_X) {
|
||||
ED_mesh_defvert_mirror_update_em(ob, eve, -1, i, cd_dvert_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4306,17 +4302,15 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
|
|||
if (dvert_act == NULL) {
|
||||
return;
|
||||
}
|
||||
weight_act = BKE_defvert_find_weight(dvert_act, def_nr);
|
||||
|
||||
dv = me->dvert;
|
||||
for (i = 0; i < me->totvert; i++, dv++) {
|
||||
if ((me->mvert[i].flag & SELECT) && (dv != dvert_act)) {
|
||||
MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr);
|
||||
if (dw) {
|
||||
dw->weight = weight_act;
|
||||
if (me->symmetry & ME_SYMMETRY_X) {
|
||||
ED_mesh_defvert_mirror_update_ob(ob, -1, i);
|
||||
}
|
||||
|
||||
BKE_defvert_copy_index(dv, def_nr, dvert_act, def_nr);
|
||||
|
||||
if (me->symmetry & ME_SYMMETRY_X) {
|
||||
ED_mesh_defvert_mirror_update_ob(ob, -1, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue