diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-08-05 13:21:29 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-08-05 13:21:29 +0400 |
commit | c4114780d43f2cc973eaad193c61127e9ee54b28 (patch) | |
tree | dbc551eee68dde0e0104deef4d028979dc1efca6 /source/blender/blenkernel | |
parent | 7dfbe481e26f1b067315ee067f772a9195faf7f2 (diff) |
Little code cleanup.
bsystem_time was being called with an extra variable, which was useless. Most of the places that called it, were passing NULL for that variable anyway.
I've also cleaned up that function a bit, but the underlying problems with that part of the code still exist (EVIL GLOBALS that are exported for frame_to_float), for mblur and fields rendering features. That remains for another time.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 6 |
10 files changed, 35 insertions, 32 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index e38446e0d46..9022e07ebac 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -81,7 +81,7 @@ void set_mblur_offs(float blur); void set_field_offs(float field); void disable_speed_curve(int val); -float bsystem_time(struct Object *ob, struct Object *par, float cfra, float ofs); +float bsystem_time(struct Object *ob, float cfra, float ofs); void object_to_mat3(struct Object *ob, float mat[][3]); void object_to_mat4(struct Object *ob, float mat[][4]); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 0ab4c70cdae..cbe056fa1b1 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1111,7 +1111,7 @@ static void do_nla(Object *ob, int blocktype) if(cu->path) { /* Find the position on the path */ - ctime= bsystem_time(ob, parent, scene_cfra, 0.0); + ctime= bsystem_time(ob, scene_cfra, 0.0); if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) { /* correct for actions not starting on zero */ @@ -1133,7 +1133,7 @@ static void do_nla(Object *ob, int blocktype) } frametime = (striptime * actlength) + strip->actstart; - frametime= bsystem_time(ob, 0, frametime, 0.0); + frametime= bsystem_time(ob, frametime, 0.0); if(blocktype==ID_AR) { extract_pose_from_action (tpose, strip->act, frametime); @@ -1184,7 +1184,7 @@ static void do_nla(Object *ob, int blocktype) frametime = actlength * (strip->repeat-(int)strip->repeat); if(frametime<=0.000001f) frametime= actlength; /* rounding errors... */ - frametime= bsystem_time(ob, 0, frametime+strip->actstart, 0.0); + frametime= bsystem_time(ob, frametime+strip->actstart, 0.0); if(blocktype==ID_AR) extract_pose_from_action (tpose, strip->act, frametime); @@ -1267,7 +1267,7 @@ void do_all_pose_actions(Object *ob) cframe= get_action_frame(ob, cframe); - extract_pose_from_action (ob->pose, ob->action, bsystem_time(ob, 0, cframe, 0.0)); + extract_pose_from_action (ob->pose, ob->action, bsystem_time(ob, cframe, 0.0)); } else if(ob->nlastrips.first) { do_nla(ob, ID_AR); @@ -1288,9 +1288,9 @@ void do_all_object_actions(Object *ob) cframe= get_action_frame(ob, cframe); - extract_ipochannels_from_action(&tchanbase, &ob->id, ob->action, "Object", bsystem_time(ob, 0, cframe, 0.0)); + extract_ipochannels_from_action(&tchanbase, &ob->id, ob->action, "Object", bsystem_time(ob, cframe, 0.0)); if(key) - extract_ipochannels_from_action(&tchanbase, &key->id, ob->action, "Shape", bsystem_time(ob, 0, cframe, 0.0)); + extract_ipochannels_from_action(&tchanbase, &key->id, ob->action, "Shape", bsystem_time(ob, cframe, 0.0)); if(tchanbase.first) { execute_ipochannels(&tchanbase); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 01e945855b6..32ea2b3ed2c 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -582,7 +582,7 @@ static void particle_duplilist(ListBase *lb, Scene *sce, Object *par, PartEff *p if(pa==NULL) return; } - ctime= bsystem_time(par, 0, (float)G.scene->r.cfra, 0.0); + ctime= bsystem_time(par, (float)G.scene->r.cfra, 0.0); lay= G.scene->lay; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index f75174e47a2..31a25a984c4 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1922,7 +1922,7 @@ void where_is_pose (Object *ob) Bone *bone; bPoseChannel *pchan; float imat[4][4]; - float ctime= bsystem_time(ob, NULL, (float)G.scene->r.cfra, 0.0); /* not accurate... */ + float ctime= bsystem_time(ob, (float)G.scene->r.cfra, 0.0); /* not accurate... */ arm = get_armature(ob); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 2981d158a24..6cbe454b79c 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1454,7 +1454,7 @@ short get_constraint_target_matrix (bConstraint *con, short ownertype, void *own if (cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */ makeDispListCurveTypes(data->tar, 0); if (cu->path && cu->path->data) { - curvetime= bsystem_time(data->tar, data->tar->parent, (float)ctime, 0.0) - data->offset; + curvetime= bsystem_time(data->tar, (float)ctime, 0.0) - data->offset; if (calc_ipo_spec(cu->ipo, CU_SPEED, &curvetime)==0) { curvetime /= cu->pathlen; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index bf02c49b23c..16abf78952d 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -2000,7 +2000,7 @@ void do_ob_ipo(Object *ob) /* do not set ob->ctime here: for example when parent in invisible layer */ - ctime= bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0); + ctime= bsystem_time(ob, (float) G.scene->r.cfra, 0.0); calc_ipo(ob->ipo, ctime); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 345bc522449..0b5650ece44 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1025,7 +1025,7 @@ static int do_mesh_key(Object *ob, Mesh *me) for(a=0; a<me->totvert; a+=step, cfra+= delta) { - ctime= bsystem_time(0, 0, cfra, 0.0); + ctime= bsystem_time(0, cfra, 0.0); if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); @@ -1060,7 +1060,7 @@ static int do_mesh_key(Object *ob, Mesh *me) } } else { - ctime= bsystem_time(ob, 0, G.scene->r.cfra, 0.0); + ctime= bsystem_time(ob, G.scene->r.cfra, 0.0); if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; @@ -1180,7 +1180,7 @@ static int do_curve_key(Curve *cu) for(a=0; a<tot; a+=step, cfra+= delta) { - ctime= bsystem_time(0, 0, cfra, 0.0); + ctime= bsystem_time(0, cfra, 0.0); if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); @@ -1202,7 +1202,7 @@ static int do_curve_key(Curve *cu) } else { - ctime= bsystem_time(NULL, 0, (float)G.scene->r.cfra, 0.0); + ctime= bsystem_time(NULL, (float)G.scene->r.cfra, 0.0); if(cu->key->type==KEY_RELATIVE) { do_rel_cu_key(cu, ctime); @@ -1244,7 +1244,7 @@ static int do_latt_key(Object *ob, Lattice *lt) for(a=0; a<tot; a++, cfra+= delta) { - ctime= bsystem_time(0, 0, cfra, 0.0); + ctime= bsystem_time(0, cfra, 0.0); if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; CLAMP(ctime, 0.0, 1.0); @@ -1261,7 +1261,7 @@ static int do_latt_key(Object *ob, Lattice *lt) } } else { - ctime= bsystem_time(NULL, 0, (float)G.scene->r.cfra, 0.0); + ctime= bsystem_time(NULL, (float)G.scene->r.cfra, 0.0); if(lt->key->type==KEY_RELATIVE) { KeyBlock *kb; @@ -1342,7 +1342,7 @@ int do_ob_key(Object *ob) if(ob->ipoflag & OB_ACTION_KEY) do_all_object_actions(ob); else { - calc_ipo(key->ipo, bsystem_time(ob, 0, G.scene->r.cfra, 0.0)); + calc_ipo(key->ipo, bsystem_time(ob, G.scene->r.cfra, 0.0)); execute_ipo((ID *)key, key->ipo); } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index d6fa8d1d3d6..ad1c432c5a0 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -383,7 +383,7 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob, for(i = 0; i < maxFaces; ++i) faceMap[i] = i; if (ob) { - frac = bsystem_time(ob, 0, (float)G.scene->r.cfra, + frac = bsystem_time(ob, (float)G.scene->r.cfra, bmd->start - 1.0f) / bmd->length; } else { frac = G.scene->r.cfra - bmd->start / bmd->length; @@ -4330,7 +4330,7 @@ static void waveModifier_do( MVert *mvert = NULL; MDeformVert *dvert = NULL; int defgrp_index; - float ctime = bsystem_time(ob, 0, (float)G.scene->r.cfra, 0.0); + float ctime = bsystem_time(ob, (float)G.scene->r.cfra, 0.0); float minfac = (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow)); float lifefac = wmd->height; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 90cbd09b959..3f26501db6f 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1132,20 +1132,23 @@ void disable_speed_curve(int val) } /* ob can be NULL */ -float bsystem_time(Object *ob, Object *par, float cfra, float ofs) +float bsystem_time(Object *ob, float cfra, float ofs) { /* returns float ( see frame_to_float in ipo.c) */ - + + /* bluroffs and fieldoffs are ugly globals that are set by render */ cfra+= bluroffs+fieldoffs; /* global time */ cfra*= G.scene->r.framelen; - if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra); - - /* ofset frames */ - if(ob && (ob->ipoflag & OB_OFFS_PARENT)) { - if((ob->partype & PARSLOW)==0) cfra-= ob->sf; + if (ob) { + if (no_speed_curve==0 && ob->ipo) + cfra= calc_ipo_time(ob->ipo, cfra); + + /* ofset frames */ + if ((ob->ipoflag & OB_OFFS_PARENT) && (ob->partype & PARSLOW)==0) + cfra-= ob->sf; } cfra-= ofs; @@ -1236,7 +1239,7 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4]) } /* catch exceptions: curve paths used as a duplicator */ else if(enable_cu_speed) { - ctime= bsystem_time(ob, par, (float)G.scene->r.cfra, 0.0); + ctime= bsystem_time(ob, (float)G.scene->r.cfra, 0.0); if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) { ctime /= cu->pathlen; @@ -1488,7 +1491,7 @@ void where_is_object_time(Object *ob, float ctime) if(ob==NULL) return; /* this is needed to be able to grab objects with ipos, otherwise it always freezes them */ - stime= bsystem_time(ob, 0, ctime, 0.0); + stime= bsystem_time(ob, ctime, 0.0); if(stime != ob->ctime) { ob->ctime= stime; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 16a29fb8e80..93bda9ac530 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2893,7 +2893,7 @@ static int softbody_baked_step(Object *ob, float framenr, float (*vertexCos)[3], /* convert cfra time to system time */ sfra= (float)sb->sfra; - cfra= bsystem_time(ob, NULL, framenr, 0.0); + cfra= bsystem_time(ob, framenr, 0.0); efra= (float)sb->efra; dfra= (float)sb->interval; @@ -2948,7 +2948,7 @@ static void softbody_baked_add(Object *ob, float framenr) /* convert cfra time to system time */ sfra= (float)sb->sfra; fac1= ob->sf; ob->sf= 0.0f; /* disable startframe */ - cfra= bsystem_time(ob, NULL, framenr, 0.0); + cfra= bsystem_time(ob, framenr, 0.0); ob->sf= fac1; efra= (float)sb->efra; dfra= (float)sb->interval; @@ -3126,7 +3126,7 @@ void sbObjectStep(Object *ob, float framenr, float (*vertexCos)[3], int numVerts /* checking time: */ - ctime= bsystem_time(ob, NULL, framenr, 0.0); + ctime= bsystem_time(ob, framenr, 0.0); if (ob->softflag&OB_SB_RESET) { dtime = 0.0; |