[Bf-blender-cvs] [5abe5b154a8] greasepencil-refactor: GPencil: More changes to Simplify Tint

Antonio Vazquez noreply at git.blender.org
Mon Jan 6 17:08:36 CET 2020


Commit: 5abe5b154a85f548f7e14388c610afa741f135a3
Author: Antonio Vazquez
Date:   Mon Jan 6 17:08:21 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB5abe5b154a85f548f7e14388c610afa741f135a3

GPencil: More changes to Simplify Tint

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

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index e85db82b26e..30cafdcc4f5 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -52,18 +52,11 @@ struct MDeformVert;
 #define GPENCIL_SIMPLIFY_FILL(scene, playing) \
   ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
     (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL)))
-#define GPENCIL_SIMPLIFY_MODIF(scene, playing) \
-  ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
-    (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))
 #define GPENCIL_SIMPLIFY_FX(scene, playing) \
   ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
     (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX)))
-#define GPENCIL_SIMPLIFY_BLEND(scene, playing) \
-  ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
-    (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND)))
-#define GPENCIL_SIMPLIFY_TINT(scene, playing) \
-  ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
-    (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_TINT)))
+#define GPENCIL_SIMPLIFY_TINT(scene) \
+  ((GPENCIL_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_TINT))
 #define GPENCIL_SIMPLIFY_AA(scene) \
   ((GPENCIL_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_AA))
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index efdead21e57..e8f45bb1cc0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -2067,7 +2067,7 @@ void gpencil_populate_multiedit(GPENCIL_e_data *e_data,
     if (gpl->flag & GP_LAYER_HIDE) {
       continue;
     }
-    const float alpha = GPENCIL_SIMPLIFY_TINT(scene, playing) ? 0.0f : gpl->tintcolor[3];
+    const float alpha = GPENCIL_SIMPLIFY_TINT(scene) ? 0.0f : gpl->tintcolor[3];
     const float tintcolor[4] = {gpl->tintcolor[0], gpl->tintcolor[1], gpl->tintcolor[2], alpha};
 
     /* list of frames to draw */
@@ -2202,7 +2202,7 @@ void gpencil_populate_datablock(GPENCIL_e_data *e_data,
       }
     }
     /* draw normal strokes */
-    const float alpha = GPENCIL_SIMPLIFY_TINT(scene, playing) ? 0.0f : gpl->tintcolor[3];
+    const float alpha = GPENCIL_SIMPLIFY_TINT(scene) ? 0.0f : gpl->tintcolor[3];
     const float tintcolor[4] = {gpl->tintcolor[0], gpl->tintcolor[1], gpl->tintcolor[2], alpha};
     gpencil_draw_strokes(
         cache, e_data, vedata, ob, gpd, gpl, gpf_eval, opacity, tintcolor, false, cache_ob);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 64ba28ac8cc..754965e23e9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -961,6 +961,8 @@ static void gp_layer_cache_populate(bGPDlayer *gpl,
                                     bGPDstroke *UNUSED(gps),
                                     void *thunk)
 {
+  const DRWContextState *draw_ctx = DRW_context_state_get();
+  const Scene *scene = draw_ctx->scene;
   gpIterPopulateData *iter = (gpIterPopulateData *)thunk;
   bGPdata *gpd = (bGPdata *)iter->ob->data;
 
@@ -1032,7 +1034,9 @@ static void gp_layer_cache_populate(bGPDlayer *gpl,
     DRW_shgroup_uniform_float_copy(iter->grp, "layerOpacity", onion_alpha);
   }
   else {
-    DRW_shgroup_uniform_vec4_copy(iter->grp, "layerTint", gpl->tintcolor);
+    float alpha = GPENCIL_SIMPLIFY_TINT(scene) ? 0.0f : gpl->tintcolor[3];
+    float tintcolor[4] = {gpl->tintcolor[0], gpl->tintcolor[1], gpl->tintcolor[2], alpha};
+    DRW_shgroup_uniform_vec4_copy(iter->grp, "layerTint", tintcolor);
     DRW_shgroup_uniform_float_copy(iter->grp, "layerOpacity", 1.0f);
   }
 }



More information about the Bf-blender-cvs mailing list