In an exporter script i also want to export "custom properties". In my script i have the active object:
x = bpy.context.active_object
I can access the custom properties by their keys:
k = x.keys()
Blender / Cycles seems to reserve some own properties in here with the keys:
- cycles
- _RNA_UI
The values of these seem to be of type IDPropertyGroup, investigation in the python console gives:
>>> type(x['cycles'])
<class 'IDPropertyGroup'>
In my script i want to handle this as a special case and for values of IDPropertyGroup rather use value.to_dict().
So in my script i have:
for k in x.keys():
val = x[k]
print("k %s type %s" % (k, type(val)))
if isinstance(val, bpy.types.IDPropertyGroup):
val = val.to_dict()
But this gives an error that i don't understand: line 194, in execute: if isinstance(val, bpy.types.IDPropertyGroup):
AttributeError: 'RNA_Types' object has no attribute 'IDPropertyGroup'
Googling for IDPropertyGroup i get this relationship: class bpy.types.IDPropertyGroup(bpy_struct)
I wonder where this error comes from, i would expect this to work.
Thanks for any hints, Torsten