[Bf-blender-cvs] [9a727aefe13] greasepencil-object: GPencil: Use Stroke Vertex switch in paint and primitive tools

Antonio Vazquez noreply at git.blender.org
Mon Nov 4 10:52:33 CET 2019


Commit: 9a727aefe1372428d780ae8a8accbed9f7a787c5
Author: Antonio Vazquez
Date:   Mon Nov 4 10:46:59 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB9a727aefe1372428d780ae8a8accbed9f7a787c5

GPencil: Use Stroke Vertex switch in paint and primitive tools

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

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 4178bf9c923..fcddecae3e2 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -64,6 +64,18 @@ struct MDeformVert;
   ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
     (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_TINT)))
 
+/* Vertex Color macros. */
+#define GPENCIL_USE_VERTEX_COLOR(toolsettings) \
+  ((toolsettings->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR))
+#define GPENCIL_USE_VERTEX_COLOR_STROKE(toolsettings) \
+  ((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
+    ((toolsettings->gp_paint->mode == GPPAINT_MODE_STROKE) || \
+     (toolsettings->gp_paint->mode == GPPAINT_MODE_BOTH))))
+#define GPENCIL_USE_VERTEX_COLOR_FILL(toolsettings) \
+  ((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
+    ((toolsettings->gp_paint->mode == GPPAINT_MODE_FILL) || \
+     (toolsettings->gp_paint->mode == GPPAINT_MODE_BOTH))))
+
 /* ------------ Grease-Pencil API ------------------ */
 
 void BKE_gpencil_free_point_weights(struct MDeformVert *dvert);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 6f01d969695..18200bb9e97 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1009,7 +1009,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
       pt->time = ptc->time;
       /* Point mix color. */
       copy_v3_v3(pt->mix_color, brush->rgb);
-      pt->mix_color[3] = (ts->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR) ?
+      pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
                              brush->gpencil_settings->vertex_factor :
                              0.0f;
 
@@ -1045,7 +1045,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
       pt->time = ptc->time;
       /* Point mix color. */
       copy_v3_v3(pt->mix_color, brush->rgb);
-      pt->mix_color[3] = (ts->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR) ?
+      pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
                              brush->gpencil_settings->vertex_factor :
                              0.0f;
 
@@ -1171,7 +1171,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
       pt->uv_rot = ptc->uv_rot;
       /* Point mix color. */
       copy_v3_v3(pt->mix_color, brush->rgb);
-      pt->mix_color[3] = (ts->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR) ?
+      pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
                              brush->gpencil_settings->vertex_factor :
                              0.0f;
 
@@ -1864,7 +1864,7 @@ static void gp_init_colors(tGPsdata *p)
     gpd->runtime.bfill_style = gp_style->fill_style;
 
     /* Apply the mix color to stroke. */
-    if (ts->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR) {
+    if (GPENCIL_USE_VERTEX_COLOR_STROKE(ts)) {
       interp_v3_v3v3(gpd->runtime.scolor,
                      gpd->runtime.scolor,
                      brush->rgb,
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 353a4c96240..add7cbf52cf 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -162,7 +162,7 @@ static void gp_init_colors(tGPDprimitive *p)
     gpd->runtime.bfill_style = gp_style->fill_style;
 
     /* Apply the mix color to stroke. */
-    if (ts->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR) {
+    if (GPENCIL_USE_VERTEX_COLOR_STROKE(ts)) {
       interp_v3_v3v3(gpd->runtime.scolor,
                      gpd->runtime.scolor,
                      brush->rgb,
@@ -1034,7 +1034,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
     pt->uv_fac = tpt->uv_fac;
     /* Point mix color. */
     copy_v3_v3(pt->mix_color, brush->rgb);
-    pt->mix_color[3] = (ts->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR) ?
+    pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
                            brush->gpencil_settings->vertex_factor :
                            0.0f;



More information about the Bf-blender-cvs mailing list