[Bf-blender-cvs] [63eb3920d04] greasepencil-object: GPencil: Use Vertex Color for Fill areas in Draw tools

Antonio Vazquez noreply at git.blender.org
Mon Nov 4 17:49:36 CET 2019


Commit: 63eb3920d04f3af70548e53586c555a88a14b66d
Author: Antonio Vazquez
Date:   Mon Nov 4 16:25:00 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB63eb3920d04f3af70548e53586c555a88a14b66d

GPencil: Use Vertex Color for Fill areas in Draw tools

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 868d2f87bd2..da942267a94 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -973,7 +973,13 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
   gps->inittime = p->inittime;
   gps->uv_scale = 1.0f;
 
-  /* enable recalculation flag by default (only used if hq fill) */
+  /* Apply the mix color to fill. */
+  if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+    copy_v3_v3(gps->mix_color_fill, brush->rgb);
+    gps->mix_color_fill[3] = brush->gpencil_settings->vertex_factor;
+  }
+
+  /* enable recalculation flag by default */
   gps->flag |= GP_STROKE_RECALC_GEOMETRY;
 
   /* allocate enough memory for a continuous array for storage points */
@@ -1860,6 +1866,14 @@ static void gp_init_colors(tGPsdata *p)
       gpd->runtime.sfill[3] = 0.8f;
     }
 
+    /* Apply the mix color to fill. */
+    if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+      interp_v3_v3v3(gpd->runtime.sfill,
+                     gpd->runtime.sfill,
+                     brush->rgb,
+                     brush->gpencil_settings->vertex_factor);
+    }
+
     gpd->runtime.mode = (short)gp_style->mode;
     gpd->runtime.bstroke_style = gp_style->stroke_style;
     gpd->runtime.bfill_style = gp_style->fill_style;
@@ -3330,8 +3344,8 @@ static void gpencil_add_arc_points(tGPsdata *p, float mval[2], int segments)
   tGPspoint *pt_before = &points[idx_old - 1]; /* current - 2 */
   tGPspoint *pt_prev = &points[idx_old - 2];   /* previous */
 
-  /* Create two vectors, previous and half way of the actual to get the vertex of the triangle for
-   * arc curve.
+  /* Create two vectors, previous and half way of the actual to get the vertex of the triangle
+   * for arc curve.
    */
   float v_prev[2], v_cur[2], v_half[2];
   sub_v2_v2v2(v_cur, mval, &pt_prev->x);
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 26dc1745f2a..8335bb37224 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -156,6 +156,13 @@ static void gp_init_colors(tGPDprimitive *p)
     if (gpd->runtime.sfill[3] > 0.8f) {
       gpd->runtime.sfill[3] = 0.8f;
     }
+    /* Apply the mix color to fill. */
+    if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+      interp_v3_v3v3(gpd->runtime.sfill,
+                     gpd->runtime.sfill,
+                     brush->rgb,
+                     brush->gpencil_settings->vertex_factor);
+    }
 
     gpd->runtime.mode = (short)gp_style->mode;
     gpd->runtime.bstroke_style = gp_style->stroke_style;
@@ -331,6 +338,8 @@ static void gpencil_primitive_allocate_memory(tGPDprimitive *tgpi)
 static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
 {
   Scene *scene = CTX_data_scene(C);
+  ToolSettings *ts = scene->toolsettings;
+  Brush *brush = tgpi->brush;
   int cfra = CFRA;
 
   bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
@@ -354,6 +363,12 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
   gps->uv_scale = 1.0f;
   gps->inittime = 0.0f;
 
+  /* Apply the mix color to fill. */
+  if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+    copy_v3_v3(gps->mix_color_fill, brush->rgb);
+    gps->mix_color_fill[3] = brush->gpencil_settings->vertex_factor;
+  }
+
   /* enable recalculation flag by default */
   gps->flag |= GP_STROKE_RECALC_GEOMETRY;
   gps->flag &= ~GP_STROKE_SELECT;



More information about the Bf-blender-cvs mailing list