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:
authorAntonio Vazquez <blendergit@gmail.com>2019-08-30 15:19:07 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-08-30 15:26:39 +0300
commitd5d3dc418912863b172ef9f79f9991bb9d46bea8 (patch)
treed3aeb45c89025a1c5c0cabdf6ca4d3746115b848 /source/blender/editors/gpencil/gpencil_paint.c
parent4608220c9b3c0adfdab3cd6994d29c0ced748794 (diff)
GPencil: Use default material when slot material is empty
When a material slot is empty, the default material is used. The default color used is Gray to get a good contrast in dense scenes with dark and white background. Reviewers: brecht, dfelinto, mendio, pepeland Differential Revision: https://developer.blender.org/D5625
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 900883bd0af..3217c94eebd 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1244,6 +1244,14 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* Save material index */
gps->mat_nr = BKE_gpencil_object_material_get_index_from_brush(p->ob, p->brush);
+ if (gps->mat_nr < 0) {
+ if (p->ob->actcol - 1 < 0) {
+ gps->mat_nr = 0;
+ }
+ else {
+ gps->mat_nr = p->ob->actcol - 1;
+ }
+ }
/* calculate UVs along the stroke */
ED_gpencil_calc_stroke_uv(obact, gps);