[Bf-blender-cvs] [6c608a25dac] greasepencil-refactor: GPencil: Moves filling recalc to evaluation section

Antonio Vazquez noreply at git.blender.org
Tue Dec 10 12:18:13 CET 2019


Commit: 6c608a25dacb45a47bec85d32bce66f31775bb1f
Author: Antonio Vazquez
Date:   Tue Dec 10 12:17:59 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB6c608a25dacb45a47bec85d32bce66f31775bb1f

GPencil: Moves filling recalc to evaluation section

Now, instead to recalc the filling of the strokes at drawing level, the calc is done when the derived frame is created after a depsgraph tag.

This separate the drawing of the evaluation process.

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

M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 24cb99b9b5a..e706d50b4c5 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -900,6 +900,14 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
       continue;
     }
 
+    /* Loop all strokes and generate triangulation for filling. */
+    for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+      MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
+      if (gp_style) {
+        BKE_gpencil_recalc_geometry_caches(ob, gpl, gp_style, gps);
+      }
+    }
+
     /* Create a duplicate data set of stroke to modify. */
     bGPDframe *gpf_eval = NULL;
     gpencil_evaluated_frame_ensure(idx, ob, gpf, &gpf_eval);
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 9ba7801b4d4..2f3ece021b4 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -174,6 +174,7 @@ static void gp_object_verts_count_cb(bGPDlayer *UNUSED(gpl),
 {
   gpIterData *iter = (gpIterData *)thunk;
 
+#if 0 /* TODO: Remove as the calc is in evaluated modules (gpencil_modifier.c). */
   /* Calculate triangles cache for filling area (must be done only after changes) */
   if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 0) ||
       (gps->triangles == NULL)) {
@@ -185,6 +186,7 @@ static void gp_object_verts_count_cb(bGPDlayer *UNUSED(gpl),
       gps->tot_triangles = 0;
     }
   }
+#endif
 
   /* Store first index offset */
   gps->runtime.stroke_start = iter->vert_len;



More information about the Bf-blender-cvs mailing list