RNA Bugfix:
The following script would fail:
#ob = bpy.context.active_object
pb = bpy.context.active_pose_bone
pb.bone.driver_add("hide") # <--- exception here
The RNA-path function for Bone assumed that when it got called, it's
"id_data" (or owner-idblock-pointer) would only be ID_AR (i.e. an
armature). However, in the above example, pb.bone has ob as its
id_data, resulting in an invalid RNA path getting created. Added check
for this case, since it's likely to be common
This commit is contained in:
@@ -149,7 +149,20 @@ static void rna_Armature_redraw_data(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
|
||||
static char *rna_Bone_path(PointerRNA *ptr)
|
||||
{
|
||||
return BLI_sprintfN("bones[\"%s\"]", ((Bone*)ptr->data)->name);
|
||||
Bone *bone = (Bone*)ptr->data;
|
||||
|
||||
/* special exception for trying to get the path where ID-block is Object
|
||||
* - this will be assumed to be from a Pose Bone...
|
||||
*/
|
||||
if (ptr->id.data) {
|
||||
ID *id = (ID *)ptr->id.data;
|
||||
|
||||
if (GS(id->name) == ID_OB)
|
||||
return BLI_sprintfN("pose.bones[\"%s\"].bone", bone->name);
|
||||
}
|
||||
|
||||
/* from armature... */
|
||||
return BLI_sprintfN("bones[\"%s\"]", bone->name);
|
||||
}
|
||||
|
||||
static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create)
|
||||
|
||||
Reference in New Issue
Block a user