[Bf-blender-cvs] [24bce50e58e] lanpr-under-gp: LineArt: Guard early in the modifier for stopping calculation when there's no active keyframe present.

YimingWu noreply at git.blender.org
Tue Jul 21 13:32:30 CEST 2020


Commit: 24bce50e58e791b8fc15737e0d10b7dcbeb8accc
Author: YimingWu
Date:   Tue Jul 21 19:32:21 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB24bce50e58e791b8fc15737e0d10b7dcbeb8accc

LineArt: Guard early in the modifier for stopping calculation when there's no active keyframe present.

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 33e40cf4d16..497c4f071cc 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -122,6 +122,20 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
   LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
   bGPdata *gpd = ob->data;
 
+  /* Guard early, don't trigger calculation when no gpencil frame is present. Probably should
+   * disable in the isModifierDisabled() function but we need addtional arg for depsgraph and
+   * gpd.*/
+  bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
+  if (gpl == NULL) {
+    return;
+  }
+  /* Need to call this or we don't get active frame? */
+  BKE_gpencil_frame_active_set(depsgraph, gpd);
+  bGPDframe *gpf = gpl->actframe;
+  if (gpf == NULL) {
+    return;
+  }
+
   bool is_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
 
   if (ED_lineart_modifier_sync_flag_check(LRT_SYNC_IGNORE)) {
@@ -167,15 +181,6 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
   /* If we reach here, means calculation is finished (LRT_SYNC_FRESH), we grab cache. flag reset is
    * done by calculation function.*/
 
-  bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
-  if (gpl == NULL) {
-    return;
-  }
-  bGPDframe *gpf = gpl->actframe;
-  if (gpf == NULL) {
-    return;
-  }
-
   generate_strokes_actual(md, depsgraph, ob, gpl, gpf);
 
   WM_main_add_notifier(NA_EDITED | NC_GPENCIL, NULL);



More information about the Bf-blender-cvs mailing list