[Bf-blender-cvs] [6d0795628d5] greasepencil-object: Fix: Putting back bakeModifierGP() for Lattice and Hook

Joshua Leung noreply at git.blender.org
Tue Apr 17 18:16:30 CEST 2018


Commit: 6d0795628d5c3f074fd3bb450f3e437e1a8dc039
Author: Joshua Leung
Date:   Tue Apr 17 18:16:28 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6d0795628d5c3f074fd3bb450f3e437e1a8dc039

Fix: Putting back bakeModifierGP() for Lattice and Hook

Ideally, we'd run this on a depsgraph-copy, on a background thread. But, that's
that's something that we'd be passing through to the modifier bake callbacks.

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

M	source/blender/modifiers/intern/MOD_gpencilhook.c
M	source/blender/modifiers/intern/MOD_gpencillattice.c

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

diff --git a/source/blender/modifiers/intern/MOD_gpencilhook.c b/source/blender/modifiers/intern/MOD_gpencilhook.c
index b7752db0beb..d700cca6d1e 100644
--- a/source/blender/modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/modifiers/intern/MOD_gpencilhook.c
@@ -251,30 +251,21 @@ static void deformStroke(ModifierData *md, Depsgraph *UNUSED(depsgraph),
 	}
 }
 
-// FIXME: Shares code with lattice modifier...
+/* FIXME: Ideally we be doing this on a copy of the main depsgraph
+ * (i.e. one where we don't have to worry about restoring state)
+ */
 static void bakeModifierGP(const bContext *C, Depsgraph *depsgraph,
                            ModifierData *md, Object *ob)
 {
-	(void)C;
-	(void)depsgraph;
-	(void)md;
-	(void)ob;
-	
-#if 0 // FIXME
 	GpencilHookModifierData *mmd = (GpencilHookModifierData *)md;
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = md->scene;
 	bGPdata *gpd = ob->data;
 	int oldframe = CFRA;
-	/* Get depsgraph and scene layer */
-	ViewLayer *view_layer = BKE_view_layer_from_scene_get(scene);
-	Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
 
 	if (mmd->object == NULL)
 		return;
 
-	struct EvaluationContext eval_ctx_copy = *eval_ctx;
-
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
 			/* apply hook effects on this frame
@@ -285,7 +276,7 @@ static void bakeModifierGP(const bContext *C, Depsgraph *depsgraph,
 			
 			/* compute hook effects on this frame */
 			for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
-				deformStroke(md, &eval_ctx_copy, ob, gpl, gps);
+				deformStroke(md, depsgraph, ob, gpl, gps);
 			}
 		}
 	}
@@ -293,7 +284,6 @@ static void bakeModifierGP(const bContext *C, Depsgraph *depsgraph,
 	/* return frame state and DB to original state */
 	CFRA = oldframe;
 	BKE_scene_graph_update_for_newframe(depsgraph, bmain);
-#endif
 }
 
 static void freeData(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_gpencillattice.c b/source/blender/modifiers/intern/MOD_gpencillattice.c
index f18c3d3c6ff..bd02a2bec43 100644
--- a/source/blender/modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/modifiers/intern/MOD_gpencillattice.c
@@ -99,31 +99,22 @@ static void deformStroke(ModifierData *md, Depsgraph *UNUSED(depsgraph),
 	}
 }
 
-// FIXME: Shares code with hook modifier...
+/* FIXME: Ideally we be doing this on a copy of the main depsgraph
+ * (i.e. one where we don't have to worry about restoring state)
+ */
 static void bakeModifierGP(const bContext *C, Depsgraph *depsgraph,
                            ModifierData *md, Object *ob)
 {
-	(void)C;
-	(void)depsgraph;
-	(void)md;
-	(void)ob;
-	
-#if 0 // FIXME
 	GpencilLatticeModifierData *mmd = (GpencilLatticeModifierData *)md;
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = md->scene;
 	LatticeDeformData *ldata = NULL;
 	bGPdata *gpd = ob->data;
 	int oldframe = CFRA;
-	/* Get depsgraph and scene layer */
-	ViewLayer *view_layer = BKE_view_layer_from_scene_get(scene);
-	Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
 
 	if (mmd->object == NULL)
 		return;
 
-	struct EvaluationContext eval_ctx_copy = *eval_ctx;
-
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
 			/* apply lattice effects on this frame
@@ -137,7 +128,7 @@ static void bakeModifierGP(const bContext *C, Depsgraph *depsgraph,
 			
 			/* compute lattice effects on this frame */
 			for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
-				deformStroke(md, &eval_ctx_copy, ob, gpl, gps);
+				deformStroke(md, depsgraph, ob, gpl, gps);
 			}
 		}
 	}
@@ -152,7 +143,6 @@ static void bakeModifierGP(const bContext *C, Depsgraph *depsgraph,
 	/* return frame state and DB to original state */
 	CFRA = oldframe;
 	BKE_scene_graph_update_for_newframe(depsgraph, bmain);
-#endif
 }
 
 static void freeData(ModifierData *md)



More information about the Bf-blender-cvs mailing list