[Bf-blender-cvs] [e0bb1e8c077] greasepencil-refactor: Cleanup code

Antonio Vazquez noreply at git.blender.org
Sat Jan 18 11:54:41 CET 2020


Commit: e0bb1e8c077aa0b0ce288ae3c751ab0032113c0b
Author: Antonio Vazquez
Date:   Tue Jan 14 17:05:42 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBe0bb1e8c077aa0b0ce288ae3c751ab0032113c0b

Cleanup code

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

M	source/blender/blenkernel/intern/gpencil_modifier.c

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 1d39d7f508d..a64a2d38b84 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -862,12 +862,14 @@ static void gpencil_assign_object_eval(Object *object)
 
 void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
-  if (ob->greasepencil_modifiers.first == NULL) {
+  bGPdata *gpd_eval = (bGPdata *)ob->data;
+  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_eval);
+
+  if ((is_multiedit) || (ob->greasepencil_modifiers.first == NULL)) {
     return;
   }
 
   Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
-  bGPdata *gpd_eval = (bGPdata *)ob->data;
   DEG_debug_print_eval(depsgraph, __func__, gpd_eval->id.name, gpd_eval);
 
   /* If first time, do a full copy. */
@@ -927,16 +929,17 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o
 void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
   bGPdata *gpd = (bGPdata *)ob->data;
-
+  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
   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);
+  const bool do_modifiers = (bool)((is_multiedit) || (ob->greasepencil_modifiers.first == NULL));
 
-  /* Init general modifiers data. */
-  if (ob->greasepencil_modifiers.first) {
-    BKE_gpencil_lattice_init(ob);
+  if (!do_modifiers) {
+    return;
   }
 
+  /* Init general modifiers data. */
+  BKE_gpencil_lattice_init(ob);
+
   /* Loop all layers and apply modifiers. */
   for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
     /* Remap frame (Time modifier) */
@@ -970,7 +973,5 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
   }
 
   /* Clear any lattice data. */
-  if (ob->greasepencil_modifiers.first) {
-    BKE_gpencil_lattice_clear(ob);
-  }
+  BKE_gpencil_lattice_clear(ob);
 }



More information about the Bf-blender-cvs mailing list