[Bf-committers] getting class properties without creating objects

Campbell Barton ideasman42 at gmail.com
Tue May 18 08:39:18 CEST 2010


On Tue, May 18, 2010 at 8:26 AM, shuvro sarker <shuvro05 at gmail.com> wrote:
> I want to get the properties of an BPI class *without creating instances of
> it*.
> e.g. for **bpy.types.SpotLamp class I want to extract the properties like
> auto_clip_end,auto_clip_start,compression_threshold, ... etc. with the
> blender python api.
> How can it be done with blender python API?
>
> I have tried *inspect* module of python.
> inspect.getmembers(obj) does the job. But it takes object as argument, which
> I don't want.
>
> Please show me a way for doing that.
>
> Shuvro

for RNA...
bpy.types.SpotLamp.bl_rna.properties
bpy.types.SpotLamp.bl_rna.functions

bpy.types.SpotLamp.bl_rna.properties['spot_blend'].default
bpy.types.SpotLamp.bl_rna.properties['spot_blend'].hard_max

http://www.blender.org/documentation/250PythonDoc/bpy.types.FloatProperty.html

Extracting all this info for documentation is a bit cumbersome so I
added a module rna_info.py, this handles most of the internal
introspection of rna for sphinx doc generation and could help as a
reference.

We also support python functions
bpy.types.Object.__dict__.keys(), for instance shows 'scene_users'
which is defined in bpy_types.py, a utility property and not apart of
rna.

-- 
- Campbell


More information about the Bf-committers mailing list