[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36544] trunk/blender/source/blender/ makesrna/intern/rna_armature.c: RNA Bugfix:
Joshua Leung
aligorith at gmail.com
Sun May 8 07:18:41 CEST 2011
Revision: 36544
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36544
Author: aligorith
Date: 2011-05-08 05:18:40 +0000 (Sun, 08 May 2011)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_armature.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c 2011-05-08 03:42:24 UTC (rev 36543)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c 2011-05-08 05:18:40 UTC (rev 36544)
@@ -149,7 +149,20 @@
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)
More information about the Bf-blender-cvs
mailing list