diff options
author | Ton Roosendaal <ton@blender.org> | 2008-12-24 14:08:15 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-12-24 14:08:15 +0300 |
commit | e60e7f36679109a6c600f0029a60486e99d7995b (patch) | |
tree | 58cb1dfdc12d643283fbb1598b1c06a122c4fcaf /source/blender | |
parent | bc5b56e2a8f962f7116b1d8ccdd20f07e2ff0d2b (diff) |
2.5
Removed global "workob" from BKE, should now by passed on as an arg.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 38 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 42 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 16 |
7 files changed, 55 insertions, 54 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 37b1332170a..a0c8be7d7f8 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -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 diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index a4a06b704bc..6d46aad5296 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -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); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 13ceced789b..beef3e1ef1d 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -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); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6cadd57e390..7c2d4502e5e 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -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; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index cbdcfa56ff2..97a22f9d002 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -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 { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 2d7a5283b0c..51069c7d3ea 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -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; + clear_workob(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; + 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->parsubstr, ob->parsubstr); - where_is_object(&workob); + where_is_object(workob); } BoundBox *unit_boundbox() diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index ee6271d2c3b..7be4adcc0b8 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -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; |