[Bf-blender-cvs] [d76d1b7d214] greasepencil-object: GPencil: Decrease user count when the material is unpinned

Antonio Vazquez noreply at git.blender.org
Wed Nov 27 10:55:13 CET 2019


Commit: d76d1b7d214fce9362d5c499d403ac9a6f244cb0
Author: Antonio Vazquez
Date:   Wed Nov 27 10:54:43 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBd76d1b7d214fce9362d5c499d403ac9a6f244cb0

GPencil: Decrease user count when the material is unpinned

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

M	source/blender/editors/gpencil/gpencil_data.c

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

diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index cfc224a445e..e9b6c236a00 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1668,6 +1668,9 @@ static void gp_bruh_delete_mode_brushes(Main *bmain, const enum eContextObjectMo
 
     /* Before delete, unpinn any material of the brush. */
     if ((brush->gpencil_settings) && (brush->gpencil_settings->material != NULL)) {
+      Material *ma = brush->gpencil_settings->material;
+      id_us_min(&ma->id);
+
       brush->gpencil_settings->material = NULL;
       brush->gpencil_settings->flag &= ~GP_BRUSH_MATERIAL_PINNED;
     }



More information about the Bf-blender-cvs mailing list