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:
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 80795b825b0..06e5f36637b 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -51,6 +51,7 @@
#include "BKE_context.h"
#include "BKE_brush.h"
#include "BKE_global.h"
+#include "BKE_material.h"
#include "BKE_paint.h"
#include "BKE_gpencil.h"
#include "BKE_image.h"
@@ -427,7 +428,9 @@ static void gp_draw_stroke_fill(bGPdata *gpd,
const float color[4])
{
BLI_assert(gps->totpoints >= 3);
- Material *ma = gpd->mat[gps->mat_nr];
+ const bool use_mat = (gpd->mat != NULL);
+
+ Material *ma = (use_mat) ? gpd->mat[gps->mat_nr] : BKE_material_gpencil_default_get();
MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
/* Calculate triangles cache for filling area (must be done only after changes) */
@@ -869,6 +872,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
short sthickness;
float ink[4];
const bool is_unique = (tgpw->gps != NULL);
+ const bool use_mat = (tgpw->gpd->mat != NULL);
GPU_program_point_size(true);
@@ -880,7 +884,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
continue;
}
/* check if the color is visible */
- Material *ma = tgpw->gpd->mat[gps->mat_nr];
+ Material *ma = (use_mat) ? tgpw->gpd->mat[gps->mat_nr] : BKE_material_gpencil_default_get();
MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
if ((gp_style == NULL) || (gp_style->flag & GP_STYLE_COLOR_HIDE) ||
@@ -1159,6 +1163,9 @@ void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const in
copy_v4_v4(tgpw.tintcolor, color);
tgpw.onion = true;
tgpw.custonion = true;
+ if (obact->totcol == 0) {
+ tgpw.gpd->mat = NULL;
+ }
gp_draw_strokes(&tgpw);
}