WIP PyAPI from winter camp discussions, make subtypes of the base RNA python type, eventually allowing us to have python defined RNA classes in

python - lux/pov/renderman materials, lamps etc as well as operators.

At the moment there are 2 ways to do this, The first is like subclassing from python, another (disabled) method copies the base PyTypeObject struct 
and makes some changes.

The PyType is stored in the RNA Struct for reuse, right now there are no access functions - needs to be improved.

Added a python script for printing all blend file data to the console which helps testing the api.

dir(rna) wont work for python 2.x now, use rna.__dir__() instead.
This commit is contained in:
2009-03-11 17:28:37 +00:00
parent 891c3bc663
commit 64512d3e8e
10 changed files with 488 additions and 44 deletions

View File

@@ -36,6 +36,17 @@ extern PyTypeObject pyrna_prop_Type;
#define BPy_StructRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_struct_Type))
#define BPy_PropertyRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_prop_Type))
//XXX add propper accessor function, we know this is just after next/prev pointers
#define BPy_RNA_PYTYPE( _data ) (((BPy_StructFakeType *)(_data))->py_type)
typedef struct {
void * _a;
void * _b;
PyTypeObject *py_type;
} BPy_StructFakeType;
typedef struct {
PyObject_HEAD /* required python macro */
PointerRNA ptr;
@@ -50,6 +61,9 @@ typedef struct {
PyObject *BPY_rna_module( void );
PyObject *BPY_rna_doc( void );
void BPY_rna_init_types( void );
void BPY_rna_free_types( void );
PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr );
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop );