diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-08 04:13:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-08 04:13:19 +0300 |
commit | fac2ca1c7ca26b9e7019d5c3367b1cb758ba8ca4 (patch) | |
tree | 9f4b7e554ceee580d01fb22702d8b6ff01064bbf /source/blender/python/intern/bpy_rna.h | |
parent | 30c4c4599dfb72b430a409648bb1407a0f197332 (diff) |
bpy/rna api class feature
- python defined classes will be used when available (otherwise automaically generated metaclasses are made as before)
- use properties rather then functions for python defined rna class's
- call the classes getattr AFTER doing an RNA lookup, avoids setting and clearing exceptions for most attribute lookups, tested UI scripts are ~25% faster.
- extending rna py classes this way is a nicer alternative to modifying the generated metaclasses in place.
Example class
--- snip
class Object(bpy.types.ID):
def _get_children(self):
return [child for child in bpy.data.objects if child.parent == self]
children = property(_get_children)
--- snip
The C initialization function looks in bpy_types.py for classes matching RNA structure names, using them when available.
This means all objects in python will be instances of these classes.
Python properties/funcs defined in ID py class will also be available for subclasses for eg. (Group Mesh etc)
Diffstat (limited to 'source/blender/python/intern/bpy_rna.h')
-rw-r--r-- | source/blender/python/intern/bpy_rna.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index d480fd3ec9b..fe38ddb6bd9 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -64,6 +64,7 @@ typedef struct { /* cheap trick */ #define BPy_BaseTypeRNA BPy_PropertyRNA +void BPY_rna_init( void ); PyObject *BPY_rna_module( void ); void BPY_update_rna_module( void ); /*PyObject *BPY_rna_doc( void );*/ |