[Bf-blender-cvs] [b403b8196ba] master: Fix T70610: GPencil Remove Vertex Group don't reassign other groups

Antonio Vazquez noreply at git.blender.org
Mon Oct 7 20:40:07 CEST 2019


Commit: b403b8196bafed5ca52f11bf1640d508dbd53eb0
Author: Antonio Vazquez
Date:   Mon Oct 7 20:39:51 2019 +0200
Branches: master
https://developer.blender.org/rBb403b8196bafed5ca52f11bf1640d508dbd53eb0

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.

===================================================================

M	source/blender/blenkernel/intern/gpencil.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index f78833a0ebe..71fd7e26162 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -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--;
                   }



More information about the Bf-blender-cvs mailing list