Removed global "workob" from BKE, should now by passed on as an arg.
This commit is contained in:
2008-12-24 11:08:15 +00:00
parent bc5b56e2a8
commit e60e7f3667
7 changed files with 56 additions and 55 deletions

View File

@@ -133,7 +133,7 @@ void extract_pose_from_action(struct bPose *pose, struct bAction *act, float cti
/**
* Get the effects of the given action using a workob
*/
void what_does_obaction(struct Object *ob, struct bAction *act, float cframe);
void what_does_obaction(struct Object *ob, struct Object *workob, struct bAction *act, float cframe);
/**
* Iterate through the action channels of the action

View File

@@ -45,7 +45,9 @@ struct BulletSoftBody;
struct Group;
struct bAction;
void clear_workob(void);
void clear_workob(struct Object *workob);
void what_does_parent(struct Object *ob, struct Object *workob);
void copy_baseflags(void);
void copy_objectflags(void);
struct SoftBody *copy_softbody(struct SoftBody *sb);
@@ -104,8 +106,6 @@ void where_is_object_time(struct Object *ob, float ctime);
void where_is_object(struct Object *ob);
void where_is_object_simul(struct Object *ob);
void what_does_parent(struct Object *ob);
struct BoundBox *unit_boundbox(void);
void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]);
struct BoundBox *object_get_boundbox(struct Object *ob);

View File

@@ -1225,35 +1225,35 @@ static Object *get_parent_path(Object *ob)
/* For the calculation of the effects of an action at the given frame on an object
* This is currently only used for the action constraint
*/
void what_does_obaction (Object *ob, bAction *act, float cframe)
void what_does_obaction (Object *ob, Object *workob, bAction *act, float cframe)
{
ListBase tchanbase= {NULL, NULL};
clear_workob();
Mat4CpyMat4(workob.obmat, ob->obmat);
Mat4CpyMat4(workob.parentinv, ob->parentinv);
Mat4CpyMat4(workob.constinv, ob->constinv);
workob.parent= ob->parent;
workob.track= ob->track;
clear_workob(workob);
Mat4CpyMat4(workob->obmat, ob->obmat);
Mat4CpyMat4(workob->parentinv, ob->parentinv);
Mat4CpyMat4(workob->constinv, ob->constinv);
workob->parent= ob->parent;
workob->track= ob->track;
workob.trackflag= ob->trackflag;
workob.upflag= ob->upflag;
workob->trackflag= ob->trackflag;
workob->upflag= ob->upflag;
workob.partype= ob->partype;
workob.par1= ob->par1;
workob.par2= ob->par2;
workob.par3= ob->par3;
workob->partype= ob->partype;
workob->par1= ob->par1;
workob->par2= ob->par2;
workob->par3= ob->par3;
workob.constraints.first = ob->constraints.first;
workob.constraints.last = ob->constraints.last;
workob->constraints.first = ob->constraints.first;
workob->constraints.last = ob->constraints.last;
strcpy(workob.parsubstr, ob->parsubstr);
strcpy(workob.id.name, ob->id.name);
strcpy(workob->parsubstr, ob->parsubstr);
strcpy(workob->id.name, ob->id.name);
/* extract_ipochannels_from_action needs id's! */
workob.action= act;
workob->action= act;
extract_ipochannels_from_action(&tchanbase, &workob.id, act, "Object", bsystem_time(&workob, cframe, 0.0));
extract_ipochannels_from_action(&tchanbase, &workob->id, act, "Object", bsystem_time(workob, cframe, 0.0));
if (tchanbase.first) {
execute_ipochannels(&tchanbase);

View File

@@ -213,8 +213,6 @@ void initglobals(void)
G.windowstate = G_WINDOWSTATE_USERDEF;
#endif
clear_workob(); /* object.c */
G.charstart = 0x0000;
G.charmin = 0x0000;
G.charmax = 0xffff;

View File

@@ -2046,8 +2046,9 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
free_pose(pose);
}
else if (cob->type == CONSTRAINT_OBTYPE_OBJECT) {
Object workob;
/* evaluate using workob */
what_does_obaction(cob->ob, data->act, t);
what_does_obaction(cob->ob, &workob, data->act, t);
object_to_mat4(&workob, ct->matrix);
}
else {

View File

@@ -120,13 +120,12 @@
static void solve_parenting (Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul);
float originmat[3][3]; /* after where_is_object(), can be used in other functions (bad!) */
Object workob;
void clear_workob(void)
void clear_workob(Object *workob)
{
memset(&workob, 0, sizeof(Object));
memset(workob, 0, sizeof(Object));
workob.size[0]= workob.size[1]= workob.size[2]= 1.0;
workob->size[0]= workob->size[1]= workob->size[2]= 1.0;
}
@@ -2106,29 +2105,30 @@ for a lamp that is the child of another object */
}
/* for calculation of the inverse parent transform, only used for editor */
void what_does_parent(Object *ob)
void what_does_parent(Object *ob, Object *workob)
{
clear_workob();
Mat4One(workob.obmat);
Mat4One(workob.parentinv);
Mat4One(workob.constinv);
workob.parent= ob->parent;
workob.track= ob->track;
workob.trackflag= ob->trackflag;
workob.upflag= ob->upflag;
clear_workob(workob);
workob.partype= ob->partype;
workob.par1= ob->par1;
workob.par2= ob->par2;
workob.par3= ob->par3;
Mat4One(workob->obmat);
Mat4One(workob->parentinv);
Mat4One(workob->constinv);
workob->parent= ob->parent;
workob->track= ob->track;
workob.constraints.first = ob->constraints.first;
workob.constraints.last = ob->constraints.last;
workob->trackflag= ob->trackflag;
workob->upflag= ob->upflag;
workob->partype= ob->partype;
workob->par1= ob->par1;
workob->par2= ob->par2;
workob->par3= ob->par3;
strcpy(workob.parsubstr, ob->parsubstr);
workob->constraints.first = ob->constraints.first;
workob->constraints.last = ob->constraints.last;
where_is_object(&workob);
strcpy(workob->parsubstr, ob->parsubstr);
where_is_object(workob);
}
BoundBox *unit_boundbox()

View File

@@ -792,13 +792,14 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
* apply-size-rot or object center for eg */
static void ignore_parent_tx( Object *ob )
{
Object workob;
Object *ob_child;
/* a change was made, adjust the children to compensate */
for (ob_child=G.main->object.first; ob_child; ob_child=ob_child->id.next) {
if (ob_child->parent == ob) {
apply_obmat(ob_child);
what_does_parent(ob_child);
what_does_parent(ob_child, &workob);
Mat4Invert(ob_child->parentinv, workob.obmat);
}
}
@@ -1221,6 +1222,8 @@ void make_vertex_parent(Scene *scene, View3D *v3d)
error("Loop in parents");
}
else {
Object workob;
ob->parent= BASACT->object;
if(v3) {
ob->partype= PARVERT3;
@@ -1229,18 +1232,16 @@ void make_vertex_parent(Scene *scene, View3D *v3d)
ob->par3= v3-1;
/* inverse parent matrix */
what_does_parent(ob);
what_does_parent(ob, &workob);
Mat4Invert(ob->parentinv, workob.obmat);
clear_workob();
}
else {
ob->partype= PARVERT1;
ob->par1= v1-1;
/* inverse parent matrix */
what_does_parent(ob);
what_does_parent(ob, &workob);
Mat4Invert(ob->parentinv, workob.obmat);
clear_workob();
}
}
}
@@ -1384,7 +1385,7 @@ oldcode()
base->object->partype= mode;
}
else
what_does_parent(base->object);
what_does_parent(base->object, &workob);
Mat4Invert(base->object->parentinv, workob.obmat);
}
}
@@ -1471,6 +1472,7 @@ static int make_parent_exec(bContext *C, wmOperator *op)
error("Loop in parents");
}
else {
Object workob;
/* apply transformation of previous parenting */
apply_obmat(ob);
@@ -1488,7 +1490,7 @@ static int make_parent_exec(bContext *C, wmOperator *op)
}
/* calculate inverse parent matrix */
what_does_parent(ob);
what_does_parent(ob, &workob);
Mat4Invert(ob->parentinv, workob.obmat);
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;