fix for BUILTIN_KSI_WholeCharacter keying custom string/collection/group properties
authorCampbell Barton <ideasman42@gmail.com>
Sun, 9 Oct 2011 02:11:43 +0000 (02:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 9 Oct 2011 02:11:43 +0000 (02:11 +0000)
release/scripts/startup/keyingsets_builtins.py
source/blender/python/intern/bpy_rna.c

index e99966ce58f1e9d2aa40b2a1be3f584a7fa9e6fa..c7922a0dfa197ca8990b8d069607a1fe8d7cb748 100644 (file)
@@ -353,8 +353,13 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
 
     # custom properties
     def doCustomProps(ksi, ks, bone):
+
+        prop_type_compat = {bpy.types.BooleanProperty,
+                            bpy.types.IntProperty,
+                            bpy.types.FloatProperty}
+
         # go over all custom properties for bone
-        for prop, val in bone.items():
+        for prop in bone.keys():
             # ignore special "_RNA_UI" used for UI editing
             if prop == "_RNA_UI":
                 continue
@@ -362,7 +367,9 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
             # for now, just add all of 'em
             prop_rna = type(bone).bl_rna.properties.get(prop, None)
             if prop_rna is None:
-                ksi.addProp(ks, bone, '["%s"]' % prop)
+                prop_path = '["%s"]' % prop
+                if bone.path_resolve(prop_path, False).rna_type in prop_type_compat:
+                    ksi.addProp(ks, bone, prop_path)
             elif prop_rna.is_animatable:
                 ksi.addProp(ks, bone, prop)
 
index f79f1d01a96770a774ad25c56d4f79363fd3aaaa..4bdcc7838f1b1eb36838a5245d93a2ff539c9209 100644 (file)
@@ -3655,12 +3655,22 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
        Py_RETURN_NONE;
 }
 
+static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self)
+{
+       PointerRNA tptr;
+       RNA_pointer_create(NULL, &RNA_Property, self->prop, &tptr);
+       return pyrna_struct_Subtype(&tptr);
+}
+
+
+
 /*****************************************************************************/
 /* Python attributes get/set structure:                                      */
 /*****************************************************************************/
 
 static PyGetSetDef pyrna_prop_getseters[]= {
        {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
+       {(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL},
        {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
 };