pyrna - add own callable function type rather then using a standard python method, gives small speedup drawing buttons since every layout.prop/col/operator/menu etc creates and throws away one of these.

This commit is contained in:
2011-08-05 16:21:37 +00:00
parent db319f8544
commit 85fe36ab61
2 changed files with 115 additions and 30 deletions

View File

@@ -71,6 +71,7 @@ extern PyTypeObject pyrna_struct_Type;
extern PyTypeObject pyrna_prop_Type;
extern PyTypeObject pyrna_prop_array_Type;
extern PyTypeObject pyrna_prop_collection_Type;
extern PyTypeObject pyrna_func_Type;
#define BPy_StructRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_struct_Type))
#define BPy_StructRNA_CheckExact(v) (Py_TYPE(v) == &pyrna_struct_Type)
@@ -142,6 +143,15 @@ typedef struct {
CollectionPropertyIterator iter;
} BPy_PropertyCollectionIterRNA;
typedef struct {
PyObject_HEAD /* required python macro */
#ifdef USE_WEAKREFS
PyObject *in_weakreflist;
#endif
PointerRNA ptr;
FunctionRNA *func;
} BPy_FunctionRNA;
/* cheap trick */
#define BPy_BaseTypeRNA BPy_PropertyRNA