diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 20 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 19 |
9 files changed, 31 insertions, 39 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 725ebfaa645..85a986d3460 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -86,7 +86,6 @@ void set_mblur_offs(float blur); void set_field_offs(float field); void disable_speed_curve(int val); -float bsystem_time(struct Scene *scene, struct Object *ob, float cfra, float ofs); // XXX: last arg unused? void object_scale_to_mat3(struct Object *ob, float mat[][3]); void object_rot_to_mat3(struct Object *ob, float mat[][3]); void object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 4806a288cee..a6bd90c4fd2 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -86,6 +86,7 @@ void scene_select_base(struct Scene *sce, struct Base *selbase); int scene_check_setscene(struct Main *bmain, struct Scene *sce); float BKE_curframe(struct Scene *scene); +float BKE_nextframe(struct Scene *scene); void scene_update_tagged(struct Main *bmain, struct Scene *sce); void scene_clear_tagged(struct Main *bmain, struct Scene *sce); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index f939c168f51..c1f294fb102 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1230,7 +1230,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p if(G.rendering == 0) no_draw_flag |= PARS_NO_DISP; - ctime = bsystem_time(scene, par, (float)scene->r.cfra, 0.0); + ctime = BKE_curframe(scene); /* NOTE: in old animsys, used parent object's timeoffset... */ totpart = psys->totpart; totchild = psys->totchild; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index e9a19b50a81..f19ed859064 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -68,6 +68,7 @@ #include "BKE_lattice.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_scene.h" #include "BIK_api.h" #include "BKE_sketch.h" @@ -2406,7 +2407,7 @@ void where_is_pose (Scene *scene, Object *ob) if((ob->pose==NULL) || (ob->pose->flag & POSE_RECALC)) armature_rebuild_pose(ob, arm); - ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0); /* not accurate... */ + ctime= BKE_curframe(scene); /* not accurate... */ /* In editmode or restposition we read the data from the bones */ if(arm->edbo || (arm->flag & ARM_RESTPOS)) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 6d095117136..c389800b0d1 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -59,6 +59,7 @@ #include "BKE_main.h" #include "BKE_object.h" #include "BKE_deform.h" +#include "BKE_scene.h" #include "RNA_access.h" @@ -1072,7 +1073,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int for(a=0; a<tot; a+=step, cfra+= delta) { - ctime= bsystem_time(scene, NULL, cfra, 0.0); // xxx ugly cruft! + ctime= BKE_curframe(scene); #if 0 // XXX old animation system if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; @@ -1106,7 +1107,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int } } else { - ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0f); // xxx old cruft + ctime= BKE_curframe(scene); #if 0 // XXX old animation system if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) { @@ -1204,7 +1205,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in while (a < estep) { if (remain <= 0) { cfra+= delta; - ctime= bsystem_time(scene, NULL, cfra, 0.0f); // XXX old cruft + ctime= BKE_curframe(scene); ctime /= 100.0f; CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing @@ -1231,7 +1232,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in } else { - ctime= bsystem_time(scene, NULL, (float)scene->r.cfra, 0.0); + ctime= BKE_curframe(scene); if(key->type==KEY_RELATIVE) { do_rel_cu_key(cu, cu->key, actkb, ctime, out, tot); @@ -1267,7 +1268,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int for(a=0; a<tot; a++, cfra+= delta) { - ctime= bsystem_time(scene, NULL, cfra, 0.0); // XXX old cruft + ctime= BKE_curframe(scene); #if 0 // XXX old animation system if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; @@ -1298,7 +1299,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int } } else { - ctime= bsystem_time(scene, NULL, (float)scene->r.cfra, 0.0); + ctime= BKE_curframe(scene); #if 0 // XXX old animation system if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) { @@ -1462,7 +1463,7 @@ KeyBlock *add_keyblock(Key *key, const char *name) kb->pos= curpos + 0.1f; else { #if 0 // XXX old animation system - curpos= bsystem_time(scene, 0, (float)CFRA, 0.0); + curpos= BKE_curframe(scene); if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) { curpos /= 100.0; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 5782ae5f2d7..a493120e320 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1419,25 +1419,6 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) /* *************** CALC ****************** */ -/* there is also a timing calculation in drawobject() */ - - -// XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP! -/* ob can be NULL */ -float bsystem_time(struct Scene *scene, Object *UNUSED(ob), float cfra, float ofs) -{ - /* returns float ( see BKE_curframe in scene.c) */ - cfra += scene->r.subframe; - - /* global time */ - if (scene) - cfra *= scene->r.framelen; - - cfra-= ofs; - - return cfra; -} - void object_scale_to_mat3(Object *ob, float mat[][3]) { float vec[3]; @@ -1445,7 +1426,6 @@ void object_scale_to_mat3(Object *ob, float mat[][3]) size_to_mat3( mat,vec); } - void object_rot_to_mat3(Object *ob, float mat[][3]) { float rmat[3][3], dmat[3][3]; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 7678da1c7c4..f8d281c2951 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -77,6 +77,7 @@ #include "BKE_mesh.h" #include "BKE_cdderivedmesh.h" #include "BKE_pointcache.h" +#include "BKE_scene.h" #include "RE_render_ext.h" @@ -3426,7 +3427,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->totpart=0; psys->flag = PSYS_ENABLED|PSYS_CURRENT; - psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0); + psys->cfra = BKE_nextframe(scene); DAG_scene_sort(G.main, scene); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -4189,7 +4190,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta float timestep = psys_get_timestep(sim); /* negative time means "use current time" */ - cfra = state->time > 0 ? state->time : bsystem_time(sim->scene, 0, (float)sim->scene->r.cfra, 0.0); + cfra = state->time > 0 ? state->time : BKE_curframe(sim->scene); if(p>=totpart){ if(!psys->totchild) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index b327afa7df7..7a8162391d5 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2147,8 +2147,8 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra cache= pid->cache; if(timescale) { - time= bsystem_time(scene, ob, cfra, 0.0f); - nexttime= bsystem_time(scene, ob, cfra+1.0f, 0.0f); + time= BKE_curframe(scene); + nexttime= BKE_nextframe(scene); *timescale= MAX2(nexttime - time, 0.0f); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index f1e094c3909..2f24b7e735d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -910,14 +910,23 @@ int scene_check_setscene(Main *bmain, Scene *sce) } /* This function is needed to cope with fractional frames - including two Blender rendering features -* mblur (motion blur that renders 'subframes' and blurs them together), and fields rendering. */ - -/* see also bsystem_time in object.c */ + * mblur (motion blur that renders 'subframes' and blurs them together), and fields rendering. + */ float BKE_curframe(Scene *scene) { float ctime = scene->r.cfra; - ctime+= scene->r.subframe; - ctime*= scene->r.framelen; + ctime += scene->r.subframe; + ctime *= scene->r.framelen; + + return ctime; +} + +/* Similar to BKE_curframe(), but is used by physics sims to get "next time", which is defined as cfra+1 */ +float BKE_nextframe(Scene *scene) +{ + float ctime = (float)(scene->r.cfra + 1); + ctime += scene->r.subframe; + ctime *= scene->r.framelen; return ctime; } |