Bugfix [#29210] ChildOf constraint Set Inverse

For Objects, Set Inverse was unreliable as the constraint didn't get reset
properly before being calculated
This commit is contained in:
Joshua Leung 2011-11-11 00:44:48 +00:00
parent cea9c518d5
commit 4e5c03f06e

@ -700,6 +700,9 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
/* nullify inverse matrix first */
unit_m4(data->invmat);
/* try to find a pose channel */ /* try to find a pose channel */
// TODO: get from context instead? // TODO: get from context instead?
if (ob && ob->pose) if (ob && ob->pose)
@ -733,18 +736,15 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
where_is_pose(scene, ob); where_is_pose(scene, ob);
} }
else if (ob) { else if (ob) {
Object workob; Object workob = {0};
/* use what_does_parent to find inverse - just like for normal parenting.
* NOTE: what_does_parent uses a static workob defined in object.c /* use what_does_parent to find inverse - just like for normal parenting */
*/
what_does_parent(scene, ob, &workob); what_does_parent(scene, ob, &workob);
invert_m4_m4(data->invmat, workob.obmat); invert_m4_m4(data->invmat, workob.obmat);
} }
else
unit_m4(data->invmat);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob); WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }