Blender Git Commit Log

Git Commits -> Revision fac2ca1

Revision fac2ca1 by Campbell Barton (master)
November 8, 2009, 01:13 (GMT)
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)

Commit Details:

Full Hash: fac2ca1c7ca26b9e7019d5c3367b1cb758ba8ca4
SVN Revision: 24400
Parent Commit: 30c4c45
Lines Changed: +201, -169

1 Added Path:

/release/scripts/modules/bpy_types.py (+82, -0) (View)

8 Modified Paths:

/release/scripts/modules/bpy_ext/Mesh.py (+0, -72) (Diff)
/release/scripts/modules/bpy_ext/Object.py (+0, -22) (Diff)
/release/scripts/modules/bpy_ext/__init__.py (+0, -20) (Diff)
/release/scripts/op/mesh.py (+2, -2) (Diff)
/release/scripts/op/mesh_skin.py (+3, -3) (Diff)
/source/blender/python/intern/bpy_interface.c (+29, -24) (Diff)
/source/blender/python/intern/bpy_rna.c (+84, -26) (Diff)
/source/blender/python/intern/bpy_rna.h (+1, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021