[Bf-blender-cvs] [0cc2666605d] blender2.8: Fix last usages of Scene.r.cfra in modifiers code.

Bastien Montagne noreply at git.blender.org
Wed May 23 16:37:45 CEST 2018


Commit: 0cc2666605d84cc43e8be5d4b3f65f903346f205
Author: Bastien Montagne
Date:   Wed May 23 16:36:44 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0cc2666605d84cc43e8be5d4b3f65f903346f205

Fix last usages of Scene.r.cfra in modifiers code.

Note that some modifiers-related code in BKE still uses that...

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

M	source/blender/modifiers/intern/MOD_fluidsim.c
M	source/blender/modifiers/intern/MOD_fluidsim_util.c
M	source/blender/modifiers/intern/MOD_fluidsim_util.h
M	source/blender/modifiers/intern/MOD_softbody.c
M	source/blender/modifiers/intern/MOD_surface.c

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

diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index dc9f0ec11aa..e13594e46d9 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -101,8 +101,7 @@ static DerivedMesh *applyModifier(
 		}
 	}
 
-	result = fluidsimModifier_do(fluidmd, md->scene, ctx->object, dm,
-	                             ctx->flag & MOD_APPLY_RENDER, ctx->flag & MOD_APPLY_USECACHE);
+	result = fluidsimModifier_do(fluidmd, ctx, dm);
 
 	return result ? result : dm;
 }
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 1aed6309359..5f7cd1e0d60 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -52,6 +52,9 @@
 #  include "BKE_global.h"
 #endif
 
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
 #include "MOD_fluidsim_util.h"
 #include "MOD_modifiertypes.h"
 
@@ -512,17 +515,20 @@ static DerivedMesh *fluidsim_read_cache(
 #endif // WITH_MOD_FLUID
 
 DerivedMesh *fluidsimModifier_do(
-        FluidsimModifierData *fluidmd, Scene *scene,
-        Object *ob,
-        DerivedMesh *dm,
-        int useRenderParams, int UNUSED(isFinalCalc))
+        FluidsimModifierData *fluidmd,
+        const ModifierEvalContext *ctx,
+        DerivedMesh *dm)
 {
 #ifdef WITH_MOD_FLUID
+	Object *ob = ctx->object;
+	Depsgraph *depsgraph = ctx->depsgraph;
+	const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
+//	const bool isFinalCalc = (ctx->flag & MOD_APPLY_USECACHE) != 0;
 	DerivedMesh *result = NULL;
 	int framenr;
 	FluidsimSettings *fss = NULL;
 
-	framenr = (int)scene->r.cfra;
+	framenr = (int)DEG_get_ctime(depsgraph);
 	
 	/* only handle fluidsim domains */
 	if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
@@ -552,10 +558,8 @@ DerivedMesh *fluidsimModifier_do(
 #else
 	/* unused */
 	(void)fluidmd;
-	(void)scene;
-	(void)ob;
+	(void)ctx;
 	(void)dm;
-	(void)useRenderParams;
 	return NULL;
 #endif
 }
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h
index 61ad270f6c8..3329e6dbebe 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.h
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h
@@ -37,6 +37,7 @@ struct Object;
 struct Scene;
 struct FluidsimModifierData;
 struct DerivedMesh;
+struct ModifierEvalContext;
 
 /* new fluid-modifier interface */
 void fluidsim_init(struct FluidsimModifierData *fluidmd);
@@ -44,8 +45,8 @@ void fluidsim_free(struct FluidsimModifierData *fluidmd);
 
 struct DerivedMesh *fluidsimModifier_do(
         struct FluidsimModifierData *fluidmd,
-        struct Scene *scene, struct Object *ob, struct DerivedMesh *dm,
-        int useRenderParams, int isFinalCalc);
+        const struct ModifierEvalContext *ctx,
+        struct DerivedMesh *dm);
 
 #endif
 
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index a62b21df231..c16a56ee3d1 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -46,6 +46,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h".h"
 
 #include "MOD_modifiertypes.h"
 
@@ -55,7 +56,7 @@ static void deformVerts(
         float (*vertexCos)[3],
         int numVerts)
 {
-	sbObjectStep(ctx->depsgraph, md->scene, ctx->object, (float)md->scene->r.cfra, vertexCos, numVerts);
+	sbObjectStep(ctx->depsgraph, md->scene, ctx->object, DEG_get_ctime(ctx->depsgraph), vertexCos, numVerts);
 }
 
 static bool dependsOnTime(ModifierData *UNUSED(md))
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index 7f3fa125cd9..46fd3198699 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -42,6 +42,9 @@
 #include "BKE_library.h"
 #include "BKE_mesh.h"
 
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
@@ -91,6 +94,7 @@ static void deformVerts(
         int UNUSED(numVerts))
 {
 	SurfaceModifierData *surmd = (SurfaceModifierData *) md;
+	const int cfra = (int)DEG_get_ctime(ctx->depsgraph);
 	
 	if (surmd->mesh) {
 		BKE_id_free(NULL, surmd->mesh);
@@ -128,7 +132,7 @@ static void deformVerts(
 		if (numverts != surmd->numverts ||
 		    surmd->x == NULL ||
 		    surmd->v == NULL ||
-		    md->scene->r.cfra != surmd->cfra + 1)
+		    cfra != surmd->cfra + 1)
 		{
 			if (surmd->x) {
 				MEM_freeN(surmd->x);
@@ -160,7 +164,7 @@ static void deformVerts(
 			copy_v3_v3(x->co, vec);
 		}
 
-		surmd->cfra = md->scene->r.cfra;
+		surmd->cfra = cfra;
 
 		if (surmd->bvhtree)
 			free_bvhtree_from_mesh(surmd->bvhtree);



More information about the Bf-blender-cvs mailing list