diff options
author | Antonioya <blendergit@gmail.com> | 2019-03-10 13:18:52 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-03-10 13:18:52 +0300 |
commit | 81958a13938ebcf76316b12a3fa81165ae3cf230 (patch) | |
tree | dddfe9bd5204b01946c394da3c7ed8494348a708 /source/blender/editors/gpencil | |
parent | b7bcc30329251f33f4b0b58689d5489f9c42299d (diff) |
GPencil: Fix user count for autocreated materials
The user count was 2 when the value must be 1.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_add_monkey.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_add_stroke.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c index 302a6fb10f6..a4fbd4002fa 100644 --- a/source/blender/editors/gpencil/gpencil_add_monkey.c +++ b/source/blender/editors/gpencil/gpencil_add_monkey.c @@ -31,6 +31,7 @@ #include "BKE_brush.h" #include "BKE_context.h" #include "BKE_gpencil.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" @@ -63,6 +64,7 @@ static int gpencil_monkey_color( BKE_object_material_slot_add(bmain, ob); ma = BKE_material_add_gpencil(bmain, pct->name); assign_material(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF); + id_us_min(&ma->id); copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->fill_rgba, pct->fill); diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c index e02fc4bf801..d8db3cda98d 100644 --- a/source/blender/editors/gpencil/gpencil_add_stroke.c +++ b/source/blender/editors/gpencil/gpencil_add_stroke.c @@ -31,6 +31,7 @@ #include "BKE_brush.h" #include "BKE_context.h" #include "BKE_gpencil.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" @@ -62,6 +63,7 @@ static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct) BKE_object_material_slot_add(bmain, ob); ma = BKE_material_add_gpencil(bmain, pct->name); assign_material(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF); + id_us_min(&ma->id); copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->fill_rgba, pct->fill); |