[Bf-blender-cvs] [0174185e2fb] master: GPencil: New Simplify Tint option

Antonio Vazquez noreply at git.blender.org
Tue Sep 10 17:42:50 CEST 2019


Commit: 0174185e2fb75b2b7825e8d6e1bbe2b0babfa90d
Author: Antonio Vazquez
Date:   Tue Sep 10 17:37:27 2019 +0200
Branches: master
https://developer.blender.org/rB0174185e2fb75b2b7825e8d6e1bbe2b0babfa90d

GPencil: New Simplify Tint option

This is useful to disable all layers tint in one step and it will be used for future operators.

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

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 3481f9522f8..60e55dc4e93 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -677,6 +677,7 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel):
         col.prop(rd, "simplify_gpencil_view_modifier", text="Modifiers")
         col.prop(rd, "simplify_gpencil_shader_fx", text="ShaderFX")
         col.prop(rd, "simplify_gpencil_blend", text="Layers Blending")
+        col.prop(rd, "simplify_gpencil_tint", text="Layers Tinting")
 
         col.prop(rd, "simplify_gpencil_view_fill")
         sub = col.column()
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 590f8258f7d..7724ed49929 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -58,6 +58,9 @@ struct MDeformVert;
 #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)))
 
 /* ------------ Grease-Pencil API ------------------ */
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index d49cc728551..882f2285296 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1922,6 +1922,7 @@ void gpencil_populate_multiedit(GPENCIL_e_data *e_data,
 
   GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
   const DRWContextState *draw_ctx = DRW_context_state_get();
+  Scene *scene = draw_ctx->scene;
   int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph);
   GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
 
@@ -1937,39 +1938,23 @@ 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 tintcolor[4] = {gpl->tintcolor[0], gpl->tintcolor[1], gpl->tintcolor[2], alpha};
 
     /* list of frames to draw */
     if (!playing) {
       for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
         if ((gpf == gpl->actframe) || (gpf->flag & GP_FRAME_SELECT)) {
-          gpencil_draw_strokes(cache,
-                               e_data,
-                               vedata,
-                               ob,
-                               gpd,
-                               gpl,
-                               gpf,
-                               gpl->opacity,
-                               gpl->tintcolor,
-                               false,
-                               cache_ob);
+          gpencil_draw_strokes(
+              cache, e_data, vedata, ob, gpd, gpl, gpf, gpl->opacity, tintcolor, false, cache_ob);
         }
       }
     }
     else {
       gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV);
       if (gpf) {
-        gpencil_draw_strokes(cache,
-                             e_data,
-                             vedata,
-                             ob,
-                             gpd,
-                             gpl,
-                             gpf,
-                             gpl->opacity,
-                             gpl->tintcolor,
-                             false,
-                             cache_ob);
+        gpencil_draw_strokes(
+            cache, e_data, vedata, ob, gpd, gpl, gpf, gpl->opacity, tintcolor, false, cache_ob);
       }
     }
   }
@@ -2091,8 +2076,10 @@ 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 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, gpl->tintcolor, false, cache_ob);
+        cache, e_data, vedata, ob, gpd, gpl, gpf_eval, opacity, tintcolor, false, cache_ob);
   }
 
   /* create batchs and shading groups */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 2a4ba7c7eaa..3334b1eafe8 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2292,6 +2292,8 @@ typedef enum eGPencil_SimplifyFlags {
   SIMPLIFY_GPENCIL_FX = (1 << 5),
   /* Simplify layer blending */
   SIMPLIFY_GPENCIL_BLEND = (1 << 6),
+  /* Simplify layer tint */
+  SIMPLIFY_GPENCIL_TINT = (1 << 7),
 } eGPencil_SimplifyFlags;
 
 /* ToolSettings.gpencil_*_align - Stroke Placement mode flags */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 3758bd6b0ac..a91f703cbd0 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6341,6 +6341,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Layers Blending", "Do not display blend layers");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+  prop = RNA_def_property(srna, "simplify_gpencil_tint", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_TINT);
+  RNA_def_property_ui_text(prop, "Layers Tinting", "Do not display layer tint");
+  RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
   /* persistent data */
   prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);



More information about the Bf-blender-cvs mailing list