diff options
author | Antonioya <blendergit@gmail.com> | 2019-03-25 19:02:42 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-03-25 19:06:07 +0300 |
commit | 7021bd527380b4d87cf48057f0039509326b03dd (patch) | |
tree | 55126437da17d736a789d236c8a98d199a1e6260 /source/blender/editors/gpencil/gpencil_brush.c | |
parent | 84240ebb3ebde58f6bfba256e49d37697fb6bc9f (diff) |
GPencil: Only brushes with pinned materials have materials
Using GP_BRUSH_MATERIAL_PINNED to switch between active material and brush material, instead of updating all brushes on active material changes. This will allow brushes to have no material and therefore to not inflate the user count.
This fix T62465.
Patch contributed by @matc
Reviewers: @brecht @antoniov @billreynish @mendio
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_brush.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_brush.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 6e8dd11ee2f..6b646566996 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1101,14 +1101,10 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) /* Fix color references */ Material *ma = BLI_ghash_lookup(data->new_colors, &new_stroke->mat_nr); - if ((ma) && (BKE_gpencil_get_material_index(ob, ma) > 0)) { - gps->mat_nr = BKE_gpencil_get_material_index(ob, ma) - 1; - CLAMP_MIN(gps->mat_nr, 0); + gps->mat_nr = BKE_gpencil_get_material_index(ob, ma); + if (!ma || gps->mat_nr) { + gps->mat_nr = 0; } - else { - gps->mat_nr = 0; /* only if the color is not found */ - } - /* Adjust all the stroke's points, so that the strokes * get pasted relative to where the cursor is now */ |