From 97002c2d90bb067d9e5b7cd592619bf388950a48 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 31 Jan 2011 11:19:23 +0000 Subject: Bugfix [#25876] bpy.ops.constraint.childof_set_inverse has no effect This was a two-part bug: a user error + API error. * User Error: before calling bpy.ops.constraint.childof_set_inverse() for a constraint defined on a bone, you firstly need to explicitly make that bone the active bone. To do that, you do armature.bones.active = posebone.bone # or something similar * API Error: active bone setting was a bit too strict. It only allows setting the active bone if the new bone comes from the same armature, but was overlooking the fact that RNA pointers may have been created through the object using the armature instead. --- source/blender/makesrna/intern/rna_armature.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna/intern/rna_armature.c') diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 61f6176fb25..3dc52a5c4e2 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -66,12 +66,16 @@ static void rna_Armature_act_bone_set(PointerRNA *ptr, PointerRNA value) } else { if(value.id.data != arm) { - /* raise an error! */ - } - else { - arm->act_bone= value.data; - arm->act_bone->flag |= BONE_SELECTED; + Object *ob = (Object *)value.id.data; + + if(GS(ob->id.name)!=ID_OB || (ob->data != arm)) { + printf("ERROR: armature set active bone - new active doesn't come from this armature\n"); + return; + } } + + arm->act_bone= value.data; + arm->act_bone->flag |= BONE_SELECTED; } } -- cgit v1.2.3