diff options
author | Antonioya <blendergit@gmail.com> | 2019-01-20 22:31:11 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-01-20 22:31:11 +0300 |
commit | 6e443b32103505221fef86d2dcd5f4b8e6df550a (patch) | |
tree | f39036de08af22b7645b79772b2ed5772cac87c7 /source/blender | |
parent | 6e57534eaabef106a4c9c82f3d57e14a362dcceb (diff) |
Fix T60677: GP vertex groups get messed up, when deleting a group
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 9 | ||||
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 989649f65b8..ae386d24309 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1209,6 +1209,15 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup *defgroup) if (dw != NULL) { defvert_remove_group(dvert, dw); } + else { + /* reorganize weights in other strokes */ + for (int g = 0; g < gps->dvert->totweight; g++) { + MDeformWeight *dw = &dvert->dw[g]; + if ((dw != NULL) && (dw->def_nr > def_nr)) { + dw->def_nr--; + } + } + } } } } diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c index b7207b6af65..34740e5e5d0 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c @@ -586,7 +586,7 @@ void DRW_gpencil_get_edit_geom(struct GpencilBatchCacheElem *be, bGPDstroke *gps for (int i = 0; i < gps->totpoints; i++, pt++) { /* weight paint */ if (is_weight_paint) { - float weight = (dvert && dvert->dw) ? defvert_find_weight(dvert, vgindex) : 0.0f; + float weight = (dvert && dvert->dw && (vgindex > -1)) ? defvert_find_weight(dvert, vgindex) : 0.0f; float hue = 2.0f * (1.0f - weight) / 3.0f; hsv_to_rgb(hue, 1.0f, 1.0f, &selectColor[0], &selectColor[1], &selectColor[2]); selectColor[3] = 1.0f; @@ -661,7 +661,7 @@ void DRW_gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be, bGPDstroke *gp for (int i = 0; i < gps->totpoints; i++, pt++) { /* weight paint */ if (is_weight_paint) { - float weight = (dvert && dvert->dw) ? defvert_find_weight(dvert, vgindex) : 0.0f; + float weight = (dvert && dvert->dw && (vgindex > -1)) ? defvert_find_weight(dvert, vgindex) : 0.0f; float hue = 2.0f * (1.0f - weight) / 3.0f; hsv_to_rgb(hue, 1.0f, 1.0f, &selectColor[0], &selectColor[1], &selectColor[2]); selectColor[3] = 1.0f; |