From 4e5c03f06ea0834bc6575b653924a1749891bf5f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 11 Nov 2011 00:44:48 +0000 Subject: Bugfix [#29210] ChildOf constraint Set Inverse For Objects, Set Inverse was unreliable as the constraint didn't get reset properly before being calculated --- source/blender/editors/object/object_constraint.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index b36416151a9..991ed0ebd51 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -700,6 +700,9 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + /* nullify inverse matrix first */ + unit_m4(data->invmat); + /* try to find a pose channel */ // TODO: get from context instead? if (ob && ob->pose) @@ -733,18 +736,15 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) where_is_pose(scene, ob); } else if (ob) { - Object workob; - /* use what_does_parent to find inverse - just like for normal parenting. - * NOTE: what_does_parent uses a static workob defined in object.c - */ + Object workob = {0}; + + /* use what_does_parent to find inverse - just like for normal parenting */ what_does_parent(scene, ob, &workob); invert_m4_m4(data->invmat, workob.obmat); } - else - unit_m4(data->invmat); - + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob); - + return OPERATOR_FINISHED; } -- cgit v1.2.3