Fix T70610: GPencil Remove Vertex Group don't reassign other groups

When removing a vertex group, the next groups were not reassigned because the loop upper limit was wrong.
This commit is contained in:
Antonio Vazquez 2019-10-07 20:39:51 +02:00
parent 7dea058546
commit b403b8196b
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #70610, GPencil: Remove vertex group don't reassign other groups
1 changed files with 4 additions and 3 deletions

View File

@ -1397,6 +1397,7 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup *defgroup)
bGPdata *gpd = ob->data;
MDeformVert *dvert = NULL;
const int def_nr = BLI_findindex(&ob->defbase, defgroup);
const int totgrp = BLI_listbase_count(&ob->defbase);
/* Remove points data */
if (gpd) {
@ -1411,9 +1412,9 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup *defgroup)
defvert_remove_group(dvert, dw);
}
else {
/* reorganize weights in other strokes */
for (int g = 0; g < gps->dvert->totweight; g++) {
dw = &dvert->dw[g];
/* Reorganize weights in other strokes. */
for (int g = 0; g < totgrp; g++) {
dw = defvert_find_index(dvert, g);
if ((dw != NULL) && (dw->def_nr > def_nr)) {
dw->def_nr--;
}