fix for BUILTIN_KSI_WholeCharacter keying custom string/collection/group properties

This commit is contained in:
Campbell Barton
2011-10-09 02:11:43 +00:00
parent a378668ac2
commit ee8078fb12
2 changed files with 19 additions and 2 deletions

View 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)

View 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 */
};