[Bf-blender-cvs] [d184490f0e3] temp-lineart-contained: Lineart: Cache toggle for baking operators.

YimingWu noreply at git.blender.org
Thu Apr 29 16:17:45 CEST 2021


Commit: d184490f0e31e0271bf2105d106abefb489f023c
Author: YimingWu
Date:   Thu Apr 29 21:26:46 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBd184490f0e31e0271bf2105d106abefb489f023c

Lineart: Cache toggle for baking operators.

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

M	source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
index 1548a3138a6..eeec79f030c 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
@@ -112,13 +112,18 @@ static bool bake_strokes(
     /* No greasepencil frame created or found. */
     return false;
   }
+  LineartCache *local_lc = *lc;
   if (!(*lc)) {
     MOD_lineart_compute_feature_lines(dg, lmd, lc, (!(ob->dtx & OB_DRAW_IN_FRONT)));
     MOD_lineart_destroy_render_data(lmd);
   }
   else {
-    MOD_lineart_chain_clear_picked_flag(gpd->runtime.lineart_cache);
-    lmd->cache = gpd->runtime.lineart_cache;
+    if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) {
+      MOD_lineart_compute_feature_lines(dg, lmd, &local_lc, (!(ob->dtx & OB_DRAW_IN_FRONT)));
+      MOD_lineart_destroy_render_data(lmd);
+    }
+    MOD_lineart_chain_clear_picked_flag(local_lc);
+    lmd->cache = local_lc;
   }
 
   MOD_lineart_gpencil_generate(
@@ -142,6 +147,14 @@ static bool bake_strokes(
       lmd->vgname,
       lmd->flags);
 
+  if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) {
+    /* Clear local cache. */
+    MOD_lineart_clear_cache(&local_lc);
+    /* Restore the original cache pointer so the modifiers below still have access to the "global"
+     * cache. */
+    lmd->cache = gpd->runtime.lineart_cache;
+  }
+
   return true;
 }



More information about the Bf-blender-cvs mailing list