[Bf-blender-cvs] [fa65619856a] greasepencil-refactor: GPencil: First steps to add Simplify to refactor

Antonio Vazquez noreply at git.blender.org
Mon Jan 6 16:55:14 CET 2020


Commit: fa65619856a89e7a42e9e8261d051b0f91529323
Author: Antonio Vazquez
Date:   Mon Jan 6 16:53:47 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBfa65619856a89e7a42e9e8261d051b0f91529323

GPencil: First steps to add Simplify to refactor

Also, we have decided to reduce the number of simplify options because now it's not logic.

Still pending the tinting option.

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/draw/engines/gpencil/gpencil_shader_fx.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_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 74b33a1a62f..45e60ec2a16 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -732,17 +732,11 @@ class GreasePencilSimplifyPanel:
 
         col = layout.column()
         col.prop(rd, "simplify_gpencil_onplay")
-        col.prop(rd, "simplify_gpencil_view_modifier")
+        col.prop(rd, "simplify_gpencil_view_fill")
         col.prop(rd, "simplify_gpencil_shader_fx")
-        col.prop(rd, "simplify_gpencil_blend")
         col.prop(rd, "simplify_gpencil_tint")
         col.prop(rd, "simplify_gpencil_antialiasing")
 
-        col.prop(rd, "simplify_gpencil_view_fill")
-        sub = col.column()
-        sub.active = rd.simplify_gpencil_view_fill
-        sub.prop(rd, "simplify_gpencil_remove_lines")
-
 
 class GreasePencilLayerAdjustmentsPanel:
 
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 1d8184c4468..7334aff6d48 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -859,7 +859,6 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
   Object *ob_orig = DEG_get_original_object(ob);
   bGPdata *gpd = (bGPdata *)ob_orig->data;
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
-  const bool simplify_modif = GPENCIL_SIMPLIFY_MODIF(scene, false);
   const bool is_render = (bool)(DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
   const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
   int cfra_eval = (int)DEG_get_ctime(depsgraph);
@@ -890,7 +889,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
   for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
     /* Remap frame (Time modifier) */
     int remap_cfra = cfra_eval;
-    if ((time_remap) && (!simplify_modif)) {
+    if (time_remap) {
       remap_cfra = BKE_gpencil_time_modifier(depsgraph, scene, ob, gpl, cfra_eval, is_render);
     }
     bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, remap_cfra, GP_GETFRAME_USE_PREV);
@@ -913,7 +912,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
     gpencil_evaluated_frame_ensure(idx, ob, gpf, &gpf_eval);
 
     /* Skip all if some disable flag is enabled. */
-    if ((ob->greasepencil_modifiers.first == NULL) || (is_multiedit) || (simplify_modif)) {
+    if ((ob->greasepencil_modifiers.first == NULL) || (is_multiedit)) {
       idx++;
       continue;
     }
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 6c4d03a0618..efdead21e57 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1352,8 +1352,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache,
 
     /* if the fill has any value, it's considered a fill and is not drawn if simplify fill is
      * enabled */
-    if ((stl->storage->simplify_fill) &&
-        (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE)) {
+    if (stl->storage->simplify_fill) {
       if ((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) ||
           (gp_style->fill_style > GP_STYLE_FILL_STYLE_SOLID) ||
           (gpl->blend_mode != eGplBlendMode_Regular)) {
@@ -1365,7 +1364,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache,
     if ((gpl->actframe && (gpl->actframe->framenum == gpf->framenum)) || (!is_multiedit) ||
         (overlay_multiedit)) {
       /* hide any blend layer */
-      if ((!stl->storage->simplify_blend) || (gpl->blend_mode == eGplBlendMode_Regular)) {
+      if (gpl->blend_mode == eGplBlendMode_Regular) {
         /* fill */
         if ((gp_style->flag & GP_STYLE_FILL_SHOW) && (!stl->storage->simplify_fill) &&
             ((gps->flag & GP_STROKE_NOFILL) == 0)) {
@@ -2165,7 +2164,7 @@ void gpencil_populate_datablock(GPENCIL_e_data *e_data,
 
     /* remap time */
     int remap_cfra = cfra_eval;
-    if ((time_remap) && (!stl->storage->simplify_modif)) {
+    if (time_remap) {
       remap_cfra = BKE_gpencil_time_modifier(
           draw_ctx->depsgraph, scene, ob, gpl, cfra_eval, stl->storage->is_render);
     }
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 172a76c4378..64ba28ac8cc 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -469,9 +469,15 @@ static void GPENCIL_cache_init_new(void *ved)
                                  NULL :
                              false;
     pd->do_onion = show_onion && !hide_overlay && !playing;
+    /* Save simplify flags (can change while drawing, so it's better to save). */
+    Scene *scene = draw_ctx->scene;
+    pd->simplify_fill = GPENCIL_SIMPLIFY_FILL(scene, playing);
+    pd->simplify_fx = GPENCIL_SIMPLIFY_FX(scene, playing);
   }
   else {
     pd->do_onion = true;
+    pd->simplify_fill = false;
+    pd->simplify_fx = false;
   }
 
   {
@@ -690,9 +696,7 @@ void GPENCIL_cache_init(void *vedata)
 
     /* save simplify flags (can change while drawing, so it's better to save) */
     stl->storage->simplify_fill = GPENCIL_SIMPLIFY_FILL(scene, stl->storage->is_playing);
-    stl->storage->simplify_modif = GPENCIL_SIMPLIFY_MODIF(scene, stl->storage->is_playing);
     stl->storage->simplify_fx = GPENCIL_SIMPLIFY_FX(scene, stl->storage->is_playing);
-    stl->storage->simplify_blend = GPENCIL_SIMPLIFY_BLEND(scene, stl->storage->is_playing);
 
     /* xray mode */
     if (v3d) {
@@ -1044,8 +1048,8 @@ static void gp_stroke_cache_populate(bGPDlayer *UNUSED(gpl),
 
   bool hide_material = (gp_style->flag & GP_STYLE_COLOR_HIDE) != 0;
   bool show_stroke = (gp_style->flag & GP_STYLE_STROKE_SHOW) != 0;
-  // TODO: What about simplify Fill?
-  bool show_fill = (gps->tot_triangles > 0) && (gp_style->flag & GP_STYLE_FILL_SHOW) != 0;
+  bool show_fill = (gps->tot_triangles > 0) && ((gp_style->flag & GP_STYLE_FILL_SHOW) != 0) &&
+                   (!iter->pd->simplify_fill);
 
   if (hide_material || (!show_stroke && !show_fill)) {
     return;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 8eed67457ec..d4f20f1a025 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -305,9 +305,7 @@ typedef struct GPENCIL_Storage {
 
   /* simplify settings*/
   bool simplify_fill;
-  bool simplify_modif;
   bool simplify_fx;
-  bool simplify_blend;
 
   float gradient_f;
   float gradient_s[2];
@@ -528,6 +526,11 @@ typedef struct GPENCIL_PrivateData {
 
   /* Display onion skinning */
   bool do_onion;
+
+  /* simplify settings*/
+  bool simplify_fill;
+  bool simplify_fx;
+
 } GPENCIL_PrivateData;
 
 /* flags for fast drawing support */
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index 8cfabbf98f5..45ac3085959 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -1553,6 +1553,11 @@ void gpencil_vfx_cache_populate(GPENCIL_Data *vedata, Object *ob, GPENCIL_tObjec
   bGPdata *gpd = (bGPdata *)ob->data;
   GPENCIL_FramebufferList *fbl = vedata->fbl;
   GPENCIL_PrivateData *pd = vedata->stl->pd;
+  /* If simplify enabled, nothing more to do. */
+  if (pd->simplify_fx) {
+    return;
+  }
+
   /* These may not be allocated yet, use adress of future pointer. */
   gpIterVfxData iter = {
       .pd = pd,
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index a87b2f71a91..23ceb63ae94 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2274,14 +2274,8 @@ typedef enum eGPencil_SimplifyFlags {
   SIMPLIFY_GPENCIL_ON_PLAY = (1 << 1),
   /* Simplify fill on viewport */
   SIMPLIFY_GPENCIL_FILL = (1 << 2),
-  /* Simplify modifier on viewport */
-  SIMPLIFY_GPENCIL_MODIFIER = (1 << 3),
-  /* Remove fill external line */
-  SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 4),
   /* Simplify Shader FX */
   SIMPLIFY_GPENCIL_FX = (1 << 5),
-  /* Simplify layer blending */
-  SIMPLIFY_GPENCIL_BLEND = (1 << 6),
   /* Simplify layer tint */
   SIMPLIFY_GPENCIL_TINT = (1 << 7),
   /* Simplify Antialiasing */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 25e032859a4..e4c76588f0e 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6308,28 +6308,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Fill", "Display fill strokes in the viewport");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
-  prop = RNA_def_property(srna, "simplify_gpencil_remove_lines", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(
-      prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_REMOVE_FILL_LINE);
-  RNA_def_property_ui_text(prop, "Lines", "Display external lines of fill strokes");
-  RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-  prop = RNA_def_property(srna, "simplify_gpencil_view_modifier", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(
-      prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_MODIFIER);
-  RNA_def_property_ui_text(prop, "Modifiers", "Display modifiers in the viewport");
-  RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
   prop = RNA_def_property(srna, "simplify_gpencil_shader_fx", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FX);
   RNA_def_property_ui_text(prop, "ShadersFX", "Display Shader FX");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DA

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list