forked from bartvdbraak/blender
Removed old "bsystem_time()" function, which by now is just a
duplicate of BKE_curframe() which just takes two extra args. For the few calls in the physics engine where CFRA+1 instead of CFRA was being used, I've added a new BKE_nextframe() call, which will calculate for CFRA+1 instead of CFRA in much the same way that bsystem_time() would end up doing things (which means including subframe steps).
This commit is contained in:
parent
440c1c2c17
commit
723484ec06
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_unit.h"
|
||||
|
||||
#include "smoke_API.h"
|
||||
@ -3672,7 +3673,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
|
||||
totpart=psys->totpart;
|
||||
|
||||
cfra= bsystem_time(scene, NULL, (float)CFRA, 0.0f);
|
||||
cfra= BKE_curframe(scene);
|
||||
|
||||
if(draw_as==PART_DRAW_PATH && psys->pathcache==NULL && psys->childcache==NULL)
|
||||
draw_as=PART_DRAW_DOT;
|
||||
@ -6432,7 +6433,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
|
||||
for (ct= targets.first; ct; ct= ct->next) {
|
||||
/* calculate target's matrix */
|
||||
if (cti->get_target_matrix)
|
||||
cti->get_target_matrix(curcon, cob, ct, bsystem_time(scene, ob, (float)(scene->r.cfra), 0.0f));
|
||||
cti->get_target_matrix(curcon, cob, ct, BKE_curframe(scene));
|
||||
else
|
||||
unit_m4(ct->matrix);
|
||||
|
||||
|
@ -106,12 +106,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
faceMap = MEM_callocN(sizeof(*faceMap) * maxFaces, "build modifier faceMap");
|
||||
for(i = 0; i < maxFaces; ++i) faceMap[i] = i;
|
||||
|
||||
if (ob) {
|
||||
frac = bsystem_time(md->scene, ob, md->scene->r.cfra,
|
||||
bmd->start - 1.0f) / bmd->length;
|
||||
} else {
|
||||
frac = BKE_curframe(md->scene) - bmd->start / bmd->length;
|
||||
}
|
||||
frac = BKE_curframe(md->scene) - bmd->start / bmd->length;
|
||||
CLAMP(frac, 0.0f, 1.0f);
|
||||
|
||||
numFaces = dm->getNumFaces(dm) * frac;
|
||||
|
@ -804,10 +804,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
|
||||
|
||||
/* timestep= psys_get_timestep(&sim); */
|
||||
|
||||
//if(part->flag & PART_GLOB_TIME)
|
||||
cfra= BKE_curframe(scene);
|
||||
//else
|
||||
// cfra=bsystem_time(scene, ob,(float)scene->r.cfra,0.0);
|
||||
cfra= BKE_curframe(scene);
|
||||
|
||||
/* hash table for vertice <-> particle relations */
|
||||
vertpahash= BLI_edgehash_new();
|
||||
|
Loading…
Reference in New Issue
Block a user