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.
This commit is contained in:
@@ -81,7 +81,7 @@ void set_mblur_offs(float blur);
|
|||||||
void set_field_offs(float field);
|
void set_field_offs(float field);
|
||||||
void disable_speed_curve(int val);
|
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_mat3(struct Object *ob, float mat[][3]);
|
||||||
void object_to_mat4(struct Object *ob, float mat[][4]);
|
void object_to_mat4(struct Object *ob, float mat[][4]);
|
||||||
|
|
||||||
|
|||||||
@@ -1111,7 +1111,7 @@ static void do_nla(Object *ob, int blocktype)
|
|||||||
if(cu->path) {
|
if(cu->path) {
|
||||||
|
|
||||||
/* Find the position on the 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) {
|
if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
|
||||||
/* correct for actions not starting on zero */
|
/* 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 = (striptime * actlength) + strip->actstart;
|
||||||
frametime= bsystem_time(ob, 0, frametime, 0.0);
|
frametime= bsystem_time(ob, frametime, 0.0);
|
||||||
|
|
||||||
if(blocktype==ID_AR) {
|
if(blocktype==ID_AR) {
|
||||||
extract_pose_from_action (tpose, strip->act, frametime);
|
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);
|
frametime = actlength * (strip->repeat-(int)strip->repeat);
|
||||||
if(frametime<=0.000001f) frametime= actlength; /* rounding errors... */
|
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)
|
if(blocktype==ID_AR)
|
||||||
extract_pose_from_action (tpose, strip->act, frametime);
|
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);
|
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) {
|
else if(ob->nlastrips.first) {
|
||||||
do_nla(ob, ID_AR);
|
do_nla(ob, ID_AR);
|
||||||
@@ -1288,9 +1288,9 @@ void do_all_object_actions(Object *ob)
|
|||||||
|
|
||||||
cframe= get_action_frame(ob, cframe);
|
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)
|
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) {
|
if(tchanbase.first) {
|
||||||
execute_ipochannels(&tchanbase);
|
execute_ipochannels(&tchanbase);
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ static void particle_duplilist(ListBase *lb, Scene *sce, Object *par, PartEff *p
|
|||||||
if(pa==NULL) return;
|
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;
|
lay= G.scene->lay;
|
||||||
|
|
||||||
|
|||||||
@@ -1922,7 +1922,7 @@ void where_is_pose (Object *ob)
|
|||||||
Bone *bone;
|
Bone *bone;
|
||||||
bPoseChannel *pchan;
|
bPoseChannel *pchan;
|
||||||
float imat[4][4];
|
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);
|
arm = get_armature(ob);
|
||||||
|
|
||||||
|
|||||||
@@ -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! */
|
if (cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */
|
||||||
makeDispListCurveTypes(data->tar, 0);
|
makeDispListCurveTypes(data->tar, 0);
|
||||||
if (cu->path && cu->path->data) {
|
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) {
|
if (calc_ipo_spec(cu->ipo, CU_SPEED, &curvetime)==0) {
|
||||||
curvetime /= cu->pathlen;
|
curvetime /= cu->pathlen;
|
||||||
|
|||||||
@@ -2000,7 +2000,7 @@ void do_ob_ipo(Object *ob)
|
|||||||
|
|
||||||
/* do not set ob->ctime here: for example when parent in invisible layer */
|
/* 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);
|
calc_ipo(ob->ipo, ctime);
|
||||||
|
|
||||||
|
|||||||
@@ -1025,7 +1025,7 @@ static int do_mesh_key(Object *ob, Mesh *me)
|
|||||||
|
|
||||||
for(a=0; a<me->totvert; a+=step, cfra+= delta) {
|
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) {
|
if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) {
|
||||||
ctime /= 100.0;
|
ctime /= 100.0;
|
||||||
CLAMP(ctime, 0.0, 1.0);
|
CLAMP(ctime, 0.0, 1.0);
|
||||||
@@ -1060,7 +1060,7 @@ static int do_mesh_key(Object *ob, Mesh *me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) {
|
||||||
ctime /= 100.0;
|
ctime /= 100.0;
|
||||||
@@ -1180,7 +1180,7 @@ static int do_curve_key(Curve *cu)
|
|||||||
|
|
||||||
for(a=0; a<tot; a+=step, cfra+= delta) {
|
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) {
|
if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) {
|
||||||
ctime /= 100.0;
|
ctime /= 100.0;
|
||||||
CLAMP(ctime, 0.0, 1.0);
|
CLAMP(ctime, 0.0, 1.0);
|
||||||
@@ -1202,7 +1202,7 @@ static int do_curve_key(Curve *cu)
|
|||||||
}
|
}
|
||||||
else {
|
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) {
|
if(cu->key->type==KEY_RELATIVE) {
|
||||||
do_rel_cu_key(cu, ctime);
|
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) {
|
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) {
|
if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &ctime)==0) {
|
||||||
ctime /= 100.0;
|
ctime /= 100.0;
|
||||||
CLAMP(ctime, 0.0, 1.0);
|
CLAMP(ctime, 0.0, 1.0);
|
||||||
@@ -1261,7 +1261,7 @@ static int do_latt_key(Object *ob, Lattice *lt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
if(lt->key->type==KEY_RELATIVE) {
|
||||||
KeyBlock *kb;
|
KeyBlock *kb;
|
||||||
@@ -1342,7 +1342,7 @@ int do_ob_key(Object *ob)
|
|||||||
if(ob->ipoflag & OB_ACTION_KEY)
|
if(ob->ipoflag & OB_ACTION_KEY)
|
||||||
do_all_object_actions(ob);
|
do_all_object_actions(ob);
|
||||||
else {
|
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);
|
execute_ipo((ID *)key, key->ipo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob,
|
|||||||
for(i = 0; i < maxFaces; ++i) faceMap[i] = i;
|
for(i = 0; i < maxFaces; ++i) faceMap[i] = i;
|
||||||
|
|
||||||
if (ob) {
|
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;
|
bmd->start - 1.0f) / bmd->length;
|
||||||
} else {
|
} else {
|
||||||
frac = G.scene->r.cfra - bmd->start / bmd->length;
|
frac = G.scene->r.cfra - bmd->start / bmd->length;
|
||||||
@@ -4330,7 +4330,7 @@ static void waveModifier_do(
|
|||||||
MVert *mvert = NULL;
|
MVert *mvert = NULL;
|
||||||
MDeformVert *dvert = NULL;
|
MDeformVert *dvert = NULL;
|
||||||
int defgrp_index;
|
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 minfac =
|
||||||
(float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow));
|
(float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow));
|
||||||
float lifefac = wmd->height;
|
float lifefac = wmd->height;
|
||||||
|
|||||||
@@ -1132,20 +1132,23 @@ void disable_speed_curve(int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ob can be NULL */
|
/* 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) */
|
/* returns float ( see frame_to_float in ipo.c) */
|
||||||
|
|
||||||
|
/* bluroffs and fieldoffs are ugly globals that are set by render */
|
||||||
cfra+= bluroffs+fieldoffs;
|
cfra+= bluroffs+fieldoffs;
|
||||||
|
|
||||||
/* global time */
|
/* global time */
|
||||||
cfra*= G.scene->r.framelen;
|
cfra*= G.scene->r.framelen;
|
||||||
|
|
||||||
if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra);
|
if (ob) {
|
||||||
|
if (no_speed_curve==0 && ob->ipo)
|
||||||
/* ofset frames */
|
cfra= calc_ipo_time(ob->ipo, cfra);
|
||||||
if(ob && (ob->ipoflag & OB_OFFS_PARENT)) {
|
|
||||||
if((ob->partype & PARSLOW)==0) cfra-= ob->sf;
|
/* ofset frames */
|
||||||
|
if ((ob->ipoflag & OB_OFFS_PARENT) && (ob->partype & PARSLOW)==0)
|
||||||
|
cfra-= ob->sf;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfra-= ofs;
|
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 */
|
/* catch exceptions: curve paths used as a duplicator */
|
||||||
else if(enable_cu_speed) {
|
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) {
|
if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
|
||||||
ctime /= cu->pathlen;
|
ctime /= cu->pathlen;
|
||||||
@@ -1488,7 +1491,7 @@ void where_is_object_time(Object *ob, float ctime)
|
|||||||
if(ob==NULL) return;
|
if(ob==NULL) return;
|
||||||
|
|
||||||
/* this is needed to be able to grab objects with ipos, otherwise it always freezes them */
|
/* 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) {
|
if(stime != ob->ctime) {
|
||||||
|
|
||||||
ob->ctime= stime;
|
ob->ctime= stime;
|
||||||
|
|||||||
@@ -2893,7 +2893,7 @@ static int softbody_baked_step(Object *ob, float framenr, float (*vertexCos)[3],
|
|||||||
|
|
||||||
/* convert cfra time to system time */
|
/* convert cfra time to system time */
|
||||||
sfra= (float)sb->sfra;
|
sfra= (float)sb->sfra;
|
||||||
cfra= bsystem_time(ob, NULL, framenr, 0.0);
|
cfra= bsystem_time(ob, framenr, 0.0);
|
||||||
efra= (float)sb->efra;
|
efra= (float)sb->efra;
|
||||||
dfra= (float)sb->interval;
|
dfra= (float)sb->interval;
|
||||||
|
|
||||||
@@ -2948,7 +2948,7 @@ static void softbody_baked_add(Object *ob, float framenr)
|
|||||||
/* convert cfra time to system time */
|
/* convert cfra time to system time */
|
||||||
sfra= (float)sb->sfra;
|
sfra= (float)sb->sfra;
|
||||||
fac1= ob->sf; ob->sf= 0.0f; /* disable startframe */
|
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;
|
ob->sf= fac1;
|
||||||
efra= (float)sb->efra;
|
efra= (float)sb->efra;
|
||||||
dfra= (float)sb->interval;
|
dfra= (float)sb->interval;
|
||||||
@@ -3126,7 +3126,7 @@ void sbObjectStep(Object *ob, float framenr, float (*vertexCos)[3], int numVerts
|
|||||||
|
|
||||||
/* checking time: */
|
/* checking time: */
|
||||||
|
|
||||||
ctime= bsystem_time(ob, NULL, framenr, 0.0);
|
ctime= bsystem_time(ob, framenr, 0.0);
|
||||||
|
|
||||||
if (ob->softflag&OB_SB_RESET) {
|
if (ob->softflag&OB_SB_RESET) {
|
||||||
dtime = 0.0;
|
dtime = 0.0;
|
||||||
|
|||||||
@@ -1338,7 +1338,7 @@ static PyObject *Effect_getParticlesLoc( BPy_Effect * self )
|
|||||||
if( !list )
|
if( !list )
|
||||||
return EXPP_ReturnPyObjError( PyExc_MemoryError, "PyList() failed" );
|
return EXPP_ReturnPyObjError( PyExc_MemoryError, "PyList() failed" );
|
||||||
|
|
||||||
c_time= bsystem_time( ob, 0, cfra, p_time );
|
c_time= bsystem_time( ob, cfra, p_time );
|
||||||
|
|
||||||
for( a=0; a < paf->totpart; a++, pa += paf->totkey ) {
|
for( a=0; a < paf->totpart; a++, pa += paf->totkey ) {
|
||||||
|
|
||||||
|
|||||||
@@ -1116,7 +1116,7 @@ static void render_particle_system(Render *re, Object *ob, Object *par, PartEff
|
|||||||
|
|
||||||
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
||||||
else ptime= 0.0;
|
else ptime= 0.0;
|
||||||
ctime= bsystem_time(ob, 0, (float)re->scene->r.cfra, ptime);
|
ctime= bsystem_time(ob, (float)re->scene->r.cfra, ptime);
|
||||||
seed= ma->seed1;
|
seed= ma->seed1;
|
||||||
|
|
||||||
for(a=0; a<paf->totpart; a++, pa+=paf->totkey, seed++) {
|
for(a=0; a<paf->totpart; a++, pa+=paf->totkey, seed++) {
|
||||||
@@ -1353,7 +1353,7 @@ static void render_static_particle_system(Render *re, Object *ob, PartEff *paf)
|
|||||||
|
|
||||||
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
||||||
else ptime= 0.0;
|
else ptime= 0.0;
|
||||||
ctime= bsystem_time(ob, 0, (float)re->scene->r.cfra, ptime);
|
ctime= bsystem_time(ob, (float)re->scene->r.cfra, ptime);
|
||||||
seed= ma->seed1;
|
seed= ma->seed1;
|
||||||
|
|
||||||
for(a=0; a<paf->totpart; a++, pa+=paf->totkey) {
|
for(a=0; a<paf->totpart; a++, pa+=paf->totkey) {
|
||||||
|
|||||||
@@ -2610,7 +2610,7 @@ static void draw_particle_system(Base *base, PartEff *paf)
|
|||||||
|
|
||||||
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
||||||
else ptime= 0.0;
|
else ptime= 0.0;
|
||||||
ctime= bsystem_time(ob, 0, (float)(G.scene->r.cfra), ptime);
|
ctime= bsystem_time(ob, (float)(G.scene->r.cfra), ptime);
|
||||||
|
|
||||||
glPointSize(1.0);
|
glPointSize(1.0);
|
||||||
|
|
||||||
@@ -4191,7 +4191,7 @@ void draw_object(Base *base, int flag)
|
|||||||
|
|
||||||
for (curcon = list->first; curcon; curcon=curcon->next){
|
for (curcon = list->first; curcon; curcon=curcon->next){
|
||||||
if ((curcon->flag & CONSTRAINT_EXPAND)&&(curcon->type!=CONSTRAINT_TYPE_NULL)&&(constraint_has_target(curcon))){
|
if ((curcon->flag & CONSTRAINT_EXPAND)&&(curcon->type!=CONSTRAINT_TYPE_NULL)&&(constraint_has_target(curcon))){
|
||||||
get_constraint_target_matrix(curcon, TARGET_OBJECT, NULL, tmat, bsystem_time(ob, 0, (float)(G.scene->r.cfra), ob->sf));
|
get_constraint_target_matrix(curcon, TARGET_OBJECT, NULL, tmat, bsystem_time(ob, (float)(G.scene->r.cfra), ob->sf));
|
||||||
setlinestyle(3);
|
setlinestyle(3);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex3fv(tmat[3]);
|
glVertex3fv(tmat[3]);
|
||||||
|
|||||||
@@ -1029,7 +1029,37 @@ void childof_const_setinv (void *conv, void *unused)
|
|||||||
/* for now, just use pchan->constinv.
|
/* for now, just use pchan->constinv.
|
||||||
* NOTE: bad hack... doesn't work in many cases
|
* NOTE: bad hack... doesn't work in many cases
|
||||||
*/
|
*/
|
||||||
|
//Mat4CpyMat4(data->invmat, pchan->constinv);
|
||||||
|
|
||||||
|
bConstraintOb *cob;
|
||||||
|
float ctime= bsystem_time(ob, (float)G.scene->r.cfra, 0.0); /* not accurate... */
|
||||||
|
float pmat[4][4], chmat[4][4], cimat[4][4];
|
||||||
|
float vec0[3]={0,0,0}, vec1[3]={1,1,1};
|
||||||
|
|
||||||
|
/* make copies of pchan's original matrices */
|
||||||
|
Mat4CpyMat4(pmat, pchan->pose_mat);
|
||||||
|
Mat4CpyMat4(chmat, pchan->chan_mat);
|
||||||
|
Mat4CpyMat4(cimat, pchan->constinv);
|
||||||
|
|
||||||
|
|
||||||
|
/* clear pchan's transform (for constraint solving) */
|
||||||
|
LocEulSizeToMat4(pchan->chan_mat, vec0, vec0, vec1);
|
||||||
|
Mat4MulMat4(pchan->pose_mat, pmat, cimat);
|
||||||
|
Mat4One(pchan->constinv);
|
||||||
|
Mat4One(data->invmat);
|
||||||
|
|
||||||
|
/* do constraint solving - code copied from armature.c (where_is_pose_bone) */
|
||||||
|
cob= constraints_make_evalob(ob, pchan, TARGET_BONE);
|
||||||
|
solve_constraints(&pchan->constraints, cob, ctime);
|
||||||
|
constraints_clear_evalob(cob);
|
||||||
|
|
||||||
|
/* now set inverse */
|
||||||
Mat4CpyMat4(data->invmat, pchan->constinv);
|
Mat4CpyMat4(data->invmat, pchan->constinv);
|
||||||
|
|
||||||
|
/* reset data */
|
||||||
|
Mat4CpyMat4(pchan->pose_mat, pmat);
|
||||||
|
Mat4CpyMat4(pchan->chan_mat, chmat);
|
||||||
|
Mat4CpyMat4(pchan->constinv, cimat);
|
||||||
}
|
}
|
||||||
else if (ob) {
|
else if (ob) {
|
||||||
/* use what_does_parent to find inverse - just like for normal parenting.
|
/* use what_does_parent to find inverse - just like for normal parenting.
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ static KeyBlock *add_keyblock(Key *key)
|
|||||||
if(key->type == KEY_RELATIVE)
|
if(key->type == KEY_RELATIVE)
|
||||||
kb->pos= curpos+0.1;
|
kb->pos= curpos+0.1;
|
||||||
else {
|
else {
|
||||||
curpos= bsystem_time(0, 0, (float)CFRA, 0.0);
|
curpos= bsystem_time(0, (float)CFRA, 0.0);
|
||||||
if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
|
if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
|
||||||
curpos /= 100.0;
|
curpos /= 100.0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user