Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-05-08 09:18:40 +0400
committerJoshua Leung <aligorith@gmail.com>2011-05-08 09:18:40 +0400
commit85b1b459ed43a5667880f102d433cb2ac3dce7be (patch)
treeb7f9534f8503835bbe1103e90c59c043e555347b /source/blender/makesrna/intern/rna_armature.c
parent2aea765d6eebd0dccf355c83ed9cb0eac5965072 (diff)
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
Diffstat (limited to 'source/blender/makesrna/intern/rna_armature.c')
-rw-r--r--source/blender/makesrna/intern/rna_armature.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 1b07b224f87..d398bb4bb78 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -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)