[Bf-blender-cvs] [e6d1424f218] lineart-fn-cached: Lineart: Cache toggle for baking operators.

YimingWu noreply at git.blender.org
Tue Jun 15 14:09:22 CEST 2021


Commit: e6d1424f21856f5d54b9f32af4475af00311ec8a
Author: YimingWu
Date:   Thu Apr 29 21:26:46 2021 +0800
Branches: lineart-fn-cached
https://developer.blender.org/rBe6d1424f21856f5d54b9f32af4475af00311ec8a

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 061cd2c949d..619310c0173 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);
     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