[Bf-blender-cvs] [e89fa4c85b8] blender2.8: Cloth Modifier: get time from depsgraph instead of scene
Sybren A. Stüvel
noreply at git.blender.org
Tue May 22 17:11:34 CEST 2018
Commit: e89fa4c85b8e249465158215ade49e3726a0e7a0
Author: Sybren A. Stüvel
Date: Fri May 18 17:31:59 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe89fa4c85b8e249465158215ade49e3726a0e7a0
Cloth Modifier: get time from depsgraph instead of scene
===================================================================
M source/blender/blenkernel/intern/cloth.c
M source/blender/blenkernel/intern/effect.c
===================================================================
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 976b8965fa2..d769020503b 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -41,6 +41,7 @@
#include "BLI_linklist.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_cloth.h"
@@ -411,7 +412,7 @@ void clothModifier_do(ClothModifierData *clmd, struct Depsgraph *depsgraph, Scen
int cache_result;
clmd->scene= scene; /* nice to pass on later :) */
- framenr= (int)scene->r.cfra;
+ framenr = DEG_get_ctime(depsgraph);
cache= clmd->point_cache;
BKE_ptcache_id_from_cloth(&pid, ob, clmd);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 00c1c82bae8..bdf6e84a3b1 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -261,7 +261,8 @@ void pdEndEffectors(ListBase **effectors)
static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *eff)
{
- unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
+ float ctime = DEG_get_ctime(depsgraph);
+ unsigned int cfra = (unsigned int)(ctime >= 0 ? ctime : -ctime);
if (!eff->pd->rng)
eff->pd->rng = BLI_rng_new(eff->pd->seed + cfra);
else
@@ -286,7 +287,7 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
eff->flag |= PE_USE_NORMAL_DATA;
}
else if (eff->psys)
- psys_update_particle_tree(eff->psys, eff->scene->r.cfra);
+ psys_update_particle_tree(eff->psys, ctime);
/* Store object velocity */
if (eff->ob) {
@@ -556,7 +557,7 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
}
int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int real_velocity)
{
- float cfra = eff->scene->r.cfra;
+ float cfra = DEG_get_ctime(eff->depsgraph);
int ret = 0;
/* In case surface object is in Edit mode when loading the .blend, surface modifier is never executed
More information about the Bf-blender-cvs
mailing list