Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 4efc1d9eaae..2934b89c747 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -136,36 +136,39 @@ static void bakeModifier(Main *UNUSED(bmain),
bGPdata *gpd = ob->data;
int oldframe = (int)DEG_get_ctime(depsgraph);
- if (mmd->object == NULL) {
+ if ((mmd->object == NULL) || (mmd->object->type != OB_LATTICE)) {
return;
}
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
- /* apply lattice effects on this frame
- * NOTE: this assumes that we don't want lattice animation on non-keyframed frames
+ /* Apply lattice effects on this frame
+ * NOTE: this assumes that we don't want lattice animation on non-keyframed frames.
*/
CFRA = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph);
- /* recalculate lattice data */
- BKE_gpencil_lattice_init(ob);
+ /* Recalculate lattice data. */
+ if (mmd->cache_data) {
+ BKE_lattice_deform_data_destroy(mmd->cache_data);
+ }
+ mmd->cache_data = BKE_lattice_deform_data_create(mmd->object, ob);
- /* compute lattice effects on this frame */
+ /* Compute lattice effects on this frame. */
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
- /* free lingering data */
+ /* Free lingering data. */
ldata = (struct LatticeDeformData *)mmd->cache_data;
if (ldata) {
BKE_lattice_deform_data_destroy(ldata);
mmd->cache_data = NULL;
}
- /* return frame state and DB to original state */
+ /* Return frame state and DB to original state. */
CFRA = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph);
}