[Bf-blender-cvs] [ee91b4f9f8c] temp-gpencil-eval: Cleanup: Reformat fill functions

Antonio Vazquez noreply at git.blender.org
Wed Jan 15 10:22:08 CET 2020


Commit: ee91b4f9f8ce9bc73e80bbce6e97ea49a122d296
Author: Antonio Vazquez
Date:   Wed Jan 15 10:10:15 2020 +0100
Branches: temp-gpencil-eval
https://developer.blender.org/rBee91b4f9f8ce9bc73e80bbce6e97ea49a122d296

Cleanup: Reformat fill functions

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

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index f22c43d2002..fd3318b62c9 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -330,7 +330,7 @@ extern "C" {
 void BKE_gpencil_update_frame_reference_pointers(const struct bGPDframe *gpf_orig,
                                                  const struct bGPDframe *gpf_eval);
 void BKE_gpencil_update_orig_pointers(const struct Object *ob_orig, const struct Object *ob_eval);
-void BKE_gpencil_prepare_filling_data(const struct Object *ob);
+void BKE_gpencil_prepare_filling_data(const struct Object *ob_orig, const struct Object *ob_eval);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 6fbbecb7274..ecfd1ff7999 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -3839,13 +3839,9 @@ void BKE_gpencil_visible_stroke_iter(
   }
 }
 
-void BKE_gpencil_prepare_filling_data(const Object *ob)
+static void gpencil_prepare_filling(const Object *ob)
 {
   bGPdata *gpd = (bGPdata *)ob->data;
-
-  /* Loop original strokes and generate triangulation for filling.
-   * The first time this is slow, but in next loops, the strokes has all data calculated and
-   * doesn't need calc again except if some modifier update the stroke geometry. */
   for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
     for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
       for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
@@ -3859,6 +3855,15 @@ void BKE_gpencil_prepare_filling_data(const Object *ob)
   }
 }
 
+void BKE_gpencil_prepare_filling_data(const struct Object *ob_orig, const struct Object *ob_eval)
+{
+  /* ToDo: Add flag to avoid this checking if nothing has changed. */
+  /* Update original data to avoid recalculation in next loops. */
+  gpencil_prepare_filling(ob_orig);
+  /* Update evaluated data. */
+  gpencil_prepare_filling(ob_eval);
+}
+
 void BKE_gpencil_update_frame_reference_pointers(const struct bGPDframe *gpf_orig,
                                                  const struct bGPDframe *gpf_eval)
 {
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 9f256612068..75bba97ad1a 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -807,8 +807,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
         BKE_pose_pchan_index_rebuild(object_cow->pose);
       }
       if (object_cow->type == OB_GPENCIL) {
-        BKE_gpencil_prepare_filling_data(object_orig);
-        BKE_gpencil_prepare_filling_data(object_cow);
+        BKE_gpencil_prepare_filling_data(object_orig, object_cow);
         BKE_gpencil_update_orig_pointers(object_orig, object_cow);
       }
       update_particles_after_copy(depsgraph, object_orig, object_cow);



More information about the Bf-blender-cvs mailing list