VincentG
(VincentG)
1
Is it possible to list all properties of an object, a mesh or another datablock?
Every properties that would be there:
location, scale, parent, name, color, wire, pass_index, etc.
I tried to iterate in bpy.context.object with a for loop but I didn’t worked of course. How to do? layout.prop()? layout.prop_search()?
I have no idea.
Linusy
(Linusy)
2
You can use dir, but might have to filter out things you don’t want, like functions.
obj = bpy.context.object
for prop in dir(obj):
print("Name: {}, Value: {}, Type:{}".format(prop, getattr(obj, prop), type(getattr(obj, prop))))
Linusy
(Linusy)
3
You can also use the .rna_type.properties which might be more useful, can probably be done in a prettier way.
obj = bpy.context.object
for name, prop in obj.rna_type.properties.items():
print("Name: {}, Value: {}, Type:{}".format(name, prop, type(prop)))
VincentG
(VincentG)
4
Thank you Linusy! I didn’t know it, that’s very useful.