Second attempt at getting rid of bsystem_time()

Hopefully this fixes Collada. Can't really compile that to check
here...
This commit is contained in:
Joshua Leung 2011-11-06 12:12:14 +00:00
parent d738c8df1f
commit e03fdd8112
6 changed files with 12 additions and 15 deletions

@ -86,7 +86,7 @@ void scene_select_base(struct Scene *sce, struct Base *selbase);
int scene_check_setscene(struct Main *bmain, struct Scene *sce); int scene_check_setscene(struct Main *bmain, struct Scene *sce);
float BKE_curframe(struct Scene *scene); float BKE_curframe(struct Scene *scene);
float BKE_nextframe(struct Scene *scene); float BKE_frame_to_ctime(struct Scene *scene, const float frame);
void scene_update_tagged(struct Main *bmain, struct Scene *sce); void scene_update_tagged(struct Main *bmain, struct Scene *sce);
void scene_clear_tagged(struct Main *bmain, struct Scene *sce); void scene_clear_tagged(struct Main *bmain, struct Scene *sce);

@ -3427,7 +3427,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->totpart=0; psys->totpart=0;
psys->flag = PSYS_ENABLED|PSYS_CURRENT; psys->flag = PSYS_ENABLED|PSYS_CURRENT;
psys->cfra = BKE_nextframe(scene); psys->cfra = BKE_frame_to_ctime(scene, CFRA + 1);
DAG_scene_sort(G.main, scene); DAG_scene_sort(G.main, scene);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); DAG_id_tag_update(&ob->id, OB_RECALC_DATA);

@ -2148,7 +2148,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
if(timescale) { if(timescale) {
time= BKE_curframe(scene); time= BKE_curframe(scene);
nexttime= BKE_nextframe(scene); nexttime= BKE_frame_to_ctime(scene, CFRA+1);
*timescale= MAX2(nexttime - time, 0.0f); *timescale= MAX2(nexttime - time, 0.0f);
} }

@ -914,17 +914,13 @@ int scene_check_setscene(Main *bmain, Scene *sce)
*/ */
float BKE_curframe(Scene *scene) float BKE_curframe(Scene *scene)
{ {
float ctime = scene->r.cfra; return BKE_frame_to_ctime(scene, scene->r.cfra);
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 */ /* This function is used to obtain arbitrary fractional frames */
float BKE_nextframe(Scene *scene) float BKE_frame_to_ctime(Scene *scene, const float frame)
{ {
float ctime = (float)(scene->r.cfra + 1); float ctime = frame;
ctime += scene->r.subframe; ctime += scene->r.subframe;
ctime *= scene->r.framelen; ctime *= scene->r.framelen;

@ -759,7 +759,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
for (it = frames.begin(); it != frames.end(); it++) { for (it = frames.begin(); it != frames.end(); it++) {
float mat[4][4], ipar[4][4]; float mat[4][4], ipar[4][4];
float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); float ctime = BKE_frame_to_ctime(scene, *it);
BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
@ -1265,7 +1265,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
for (it = frames.begin(); it != frames.end(); it++) { for (it = frames.begin(); it != frames.end(); it++) {
float mat[4][4], ipar[4][4]; float mat[4][4], ipar[4][4];
float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); float ctime = BKE_frame_to_ctime(scene, *it);
BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);

@ -38,6 +38,7 @@ extern "C"
#include "BKE_DerivedMesh.h" #include "BKE_DerivedMesh.h"
#include "BKE_fcurve.h" #include "BKE_fcurve.h"
#include "BKE_animsys.h" #include "BKE_animsys.h"
#include "BKE_scene.h"
#ifdef NAN_BUILDINFO #ifdef NAN_BUILDINFO
extern char build_rev[]; extern char build_rev[];
#endif #endif