Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-03-25 19:02:42 +0300
committerAntonioya <blendergit@gmail.com>2019-03-25 19:06:07 +0300
commit7021bd527380b4d87cf48057f0039509326b03dd (patch)
tree55126437da17d736a789d236c8a98d199a1e6260 /source/blender/editors/gpencil/gpencil_add_monkey.c
parent84240ebb3ebde58f6bfba256e49d37697fb6bc9f (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_add_monkey.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_add_monkey.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c
index a4fbd4002fa..cd28043a6fe 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -60,11 +60,10 @@ static int gpencil_monkey_color(
}
}
+ int idx;
+
/* create a new one */
- 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);
+ ma = BKE_gpencil_handle_new_material(bmain, ob, pct->name, &idx);
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
@@ -80,7 +79,7 @@ static int gpencil_monkey_color(
ma->gp_style->flag |= GP_STYLE_FILL_SHOW;
}
- return BKE_gpencil_get_material_index(ob, ma) - 1;
+ return idx;
}
/* ***************************************************************** */
@@ -1447,10 +1446,6 @@ void ED_gpencil_create_monkey(bContext *C, Object *ob, float mat[4][4])
/* set first color as active */
ob->actcol = color_Black + 1;
- Material *ma = give_current_material(ob, ob->actcol);
- if (ma != NULL) {
- BKE_brush_update_material(bmain, ma, NULL);
- }
/* layers */
/* NOTE: For now, we just add new layers, to make it easier to separate out old/new instances */