From 8b8d4ba7effcf73d72e224d2934b6ad0f3a5ee74 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Tue, 22 Jan 2013 20:47:03 +0000 Subject: [PATCH] sim: Remove "continue physics" code This was left over from 2.4x days and is not used anymore. Now simulations are always interactive. --- source/blender/blenkernel/BKE_pointcache.h | 4 --- source/blender/blenkernel/intern/cloth.c | 2 +- .../blenkernel/intern/particle_system.c | 2 +- source/blender/blenkernel/intern/pointcache.c | 33 ++----------------- source/blender/blenkernel/intern/softbody.c | 12 ------- source/blender/editors/transform/transform.c | 6 ---- source/blender/makesdna/DNA_space_types.h | 2 +- .../blender/modifiers/intern/MOD_collision.c | 2 +- 8 files changed, 6 insertions(+), 57 deletions(-) diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 77b35e1a25c..7203400b267 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -294,10 +294,6 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra); /* Main cache writing call. */ int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra); -/****************** Continue physics ***************/ -void BKE_ptcache_set_continue_physics(struct Main *bmain, struct Scene *scene, int enable); -int BKE_ptcache_get_continue_physics(void); - /******************* Allocate & free ***************/ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches); void BKE_ptcache_free_mem(struct ListBase *mem_cache); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index fdd7dc94979..c1293542963 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -483,7 +483,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame; /* handle continuous simulation with the play button */ - if (BKE_ptcache_get_continue_physics() || ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe))) { + if ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe)) { BKE_ptcache_invalidate(cache); /* do simulation */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 5eac86a7e77..fda5f6f2ecb 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4500,7 +4500,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) int startframe = 0, endframe = 100, oldtotpart = 0; /* cache shouldn't be used for hair or "continue physics" */ - if (part->type != PART_HAIR && BKE_ptcache_get_continue_physics() == 0) { + if (part->type != PART_HAIR) { psys_clear_temp_pointcache(psys); /* set suitable cache range automatically */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 2f21e588b85..ac4b3099ba0 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2536,7 +2536,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) after= 0; if (mode == PTCACHE_RESET_DEPSGRAPH) { - if (!(cache->flag & PTCACHE_BAKED) && !BKE_ptcache_get_continue_physics()) { + if (!(cache->flag & PTCACHE_BAKED)) { after= 1; } @@ -2544,12 +2544,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) cache->flag |= PTCACHE_OUTDATED; } else if (mode == PTCACHE_RESET_BAKED) { - if (!BKE_ptcache_get_continue_physics()) { - reset= 1; - clear= 1; - } - else - cache->flag |= PTCACHE_OUTDATED; + cache->flag |= PTCACHE_OUTDATED; } else if (mode == PTCACHE_RESET_OUTDATED) { reset = 1; @@ -2695,30 +2690,6 @@ void BKE_ptcache_remove(void) } } -/* Continuous Interaction */ - -static int CONTINUE_PHYSICS = 0; - -void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable) -{ - Object *ob; - - if (CONTINUE_PHYSICS != enable) { - CONTINUE_PHYSICS = enable; - - if (CONTINUE_PHYSICS == 0) { - for (ob=bmain->object.first; ob; ob=ob->id.next) - if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED)) - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - } - } -} - -int BKE_ptcache_get_continue_physics(void) -{ - return CONTINUE_PHYSICS; -} - /* Point Cache handling */ PointCache *BKE_ptcache_add(ListBase *ptcaches) diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 79356d39235..e2c6df5e528 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -4108,18 +4108,6 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i softbody_reset(ob, sb, vertexCos, numVerts); } - /* continue physics special case */ - if (BKE_ptcache_get_continue_physics()) { - BKE_ptcache_invalidate(cache); - /* do simulation */ - dtime = timescale; - softbody_update_positions(ob, sb, vertexCos, numVerts); - softbody_step(scene, ob, sb, dtime); - softbody_to_object(ob, vertexCos, numVerts, 0); - sb->last_frame = framenr; - return; - } - /* still no points? go away */ if (sb->totpoint==0) { return; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c0242631d9e..00bdf069769 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2124,12 +2124,6 @@ void transformApply(bContext *C, TransInfo *t) t->state = TRANS_CONFIRM; } - if (BKE_ptcache_get_continue_physics()) { - // TRANSFORM_FIX_ME - //do_screenhandlers(G.curscreen); - t->redraw |= TREDRAW_HARD; - } - t->context = NULL; } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d632a886130..ae845cb5aa3 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -434,7 +434,7 @@ typedef enum eScreen_Redraws_Flag { TIME_WITH_SEQ_AUDIO = (1 << 4), /* DEPRECATED */ TIME_SEQ = (1 << 5), TIME_ALL_IMAGE_WIN = (1 << 6), - TIME_CONTINUE_PHYSICS = (1 << 7), + TIME_CONTINUE_PHYSICS = (1 << 7), /* UNUSED */ TIME_NODES = (1 << 8), TIME_CLIPS = (1 << 9), } eScreen_Redraws_Flag; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index b9384e6208e..ab141312932 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -137,7 +137,7 @@ static void deformVerts(ModifierData *md, Object *ob, numverts = dm->getNumVerts(dm); - if ((current_time > collmd->time_xnew) || (BKE_ptcache_get_continue_physics())) { + if (current_time > collmd->time_xnew) { unsigned int i; /* check if mesh has changed */