Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-17 17:28:40 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-17 17:28:40 +0400
commitf4a9215d7c80da4d39bd195c334fcb26676b12d5 (patch)
treebab7f751952eee6cfc19e7a674133cda8b247062 /source/blender/python
parent66b1dfae89cc44953bd51c5da962cab437e76972 (diff)
parentd87fcb0760202516b26a78858e3a1e81650c1598 (diff)
Cycles: svn merge -r39870:r40266 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Merging the node changes required a lot of conflict resolution, fixed the issues I could find but if you want stability you might want to wait a bit before updating.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/SConscript2
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
-rw-r--r--source/blender/python/generic/py_capi_utils.c109
-rw-r--r--source/blender/python/generic/py_capi_utils.h1
-rw-r--r--source/blender/python/intern/CMakeLists.txt3
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c4
-rw-r--r--source/blender/python/intern/bpy_driver.c7
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c359
-rw-r--r--source/blender/python/intern/gpu.c291
-rw-r--r--source/blender/python/intern/gpu.h41
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c12
12 files changed, 630 insertions, 205 deletions
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index dec0de4a6ab..9d7928c4432 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -5,7 +5,7 @@
Import ('env')
incs = '. ../editors/include ../makesdna ../makesrna ../blenlib ../blenkernel ../nodes'
-incs += ' ../imbuf ../blenloader ../render/extern/include ../windowmanager'
+incs += ' ../imbuf ../blenloader ../gpu ../render/extern/include ../windowmanager'
incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include'
incs += ' #intern/audaspace/intern ' + env['BF_PYTHON_INC']
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index f0158fe72c3..67ed90c79eb 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -344,7 +344,7 @@ void bpy_text_clear_modules(int clear_all)
/* looping over the dict */
PyObject *key, *value;
- int pos= 0;
+ Py_ssize_t pos= 0;
/* new list */
PyObject *list;
@@ -374,7 +374,7 @@ void bpy_text_clear_modules(int clear_all)
}
/* remove all our modules */
- for(pos=0; pos < PyList_Size(list); pos++) {
+ for(pos=0; pos < PyList_GET_SIZE(list); pos++) {
/* PyObject_Print(key, stderr, 0); */
key= PyList_GET_ITEM(list, pos);
PyDict_DelItem(modules, key);
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 81aea8571f8..d5bd44fc288 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -208,7 +208,77 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
return item;
}
-/* returns the exception string as a new PyUnicode object, depends on external StringIO module */
+/* similar to PyErr_Format(),
+ *
+ * implimentation - we cant actually preprend the existing exception,
+ * because it could have _any_ argiments given to it, so instead we get its
+ * __str__ output and raise our own exception including it.
+ */
+PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...)
+{
+ PyObject *error_value_prefix;
+ va_list args;
+
+ va_start(args, format);
+ error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
+ va_end(args);
+
+ if(PyErr_Occurred()) {
+ PyObject *error_type, *error_value, *error_traceback;
+ PyErr_Fetch(&error_type, &error_value, &error_traceback);
+ PyErr_Format(exception_type_prefix,
+ "%S, %.200s(%S)",
+ error_value_prefix,
+ Py_TYPE(error_value)->tp_name,
+ error_value
+ );
+ }
+ else {
+ PyErr_SetObject(exception_type_prefix,
+ error_value_prefix
+ );
+ }
+
+ Py_XDECREF(error_value_prefix);
+
+ /* dumb to always return NULL but matches PyErr_Format */
+ return NULL;
+}
+
+
+/* returns the exception string as a new PyUnicode object, depends on external traceback module */
+#if 0
+
+/* this version uses traceback module but somehow fails on UI errors */
+
+PyObject *PyC_ExceptionBuffer(void)
+{
+ PyObject *traceback_mod= NULL;
+ PyObject *format_tb_func= NULL;
+ PyObject *ret= NULL;
+
+ if(! (traceback_mod= PyImport_ImportModule("traceback")) ) {
+ goto error_cleanup;
+ }
+ else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) {
+ goto error_cleanup;
+ }
+
+ ret= PyObject_CallObject(format_tb_func, NULL);
+
+ if(ret == Py_None) {
+ Py_DECREF(ret);
+ ret= NULL;
+ }
+
+error_cleanup:
+ /* could not import the module so print the error and close */
+ Py_XDECREF(traceback_mod);
+ Py_XDECREF(format_tb_func);
+
+ return ret;
+}
+#else /* verbose, non-threadsafe version */
PyObject *PyC_ExceptionBuffer(void)
{
PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
@@ -217,20 +287,20 @@ PyObject *PyC_ExceptionBuffer(void)
PyObject *string_io_buf = NULL;
PyObject *string_io_mod= NULL;
PyObject *string_io_getvalue= NULL;
-
+
PyObject *error_type, *error_value, *error_traceback;
-
+
if (!PyErr_Occurred())
return NULL;
-
+
PyErr_Fetch(&error_type, &error_value, &error_traceback);
-
+
PyErr_Clear();
-
+
/* import io
* string_io = io.StringIO()
*/
-
+
if(! (string_io_mod= PyImport_ImportModule("io")) ) {
goto error_cleanup;
}
@@ -240,44 +310,45 @@ PyObject *PyC_ExceptionBuffer(void)
else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
goto error_cleanup;
}
-
+
Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
Py_INCREF(stderr_backup);
-
+
PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
PySys_SetObject("stderr", string_io);
-
+
PyErr_Restore(error_type, error_value, error_traceback);
PyErr_Print(); /* print the error */
PyErr_Clear();
-
+
string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
-
+
PySys_SetObject("stdout", stdout_backup);
PySys_SetObject("stderr", stderr_backup);
-
+
Py_DECREF(stdout_backup); /* now sys owns the ref again */
Py_DECREF(stderr_backup);
-
+
Py_DECREF(string_io_mod);
Py_DECREF(string_io_getvalue);
Py_DECREF(string_io); /* free the original reference */
-
+
PyErr_Clear();
return string_io_buf;
-
-
+
+
error_cleanup:
/* could not import the module so print the error and close */
Py_XDECREF(string_io_mod);
Py_XDECREF(string_io);
-
+
PyErr_Restore(error_type, error_value, error_traceback);
PyErr_Print(); /* print the error */
PyErr_Clear();
-
+
return NULL;
}
+#endif
/* string conversion, escape non-unicode chars, coerce must be set to NULL */
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 96c93ab71f8..03a8637710e 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -34,6 +34,7 @@ void PyC_ObSpit(const char *name, PyObject *var);
void PyC_LineSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
+PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
void PyC_FileAndNum(const char **filename, int *lineno);
int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix);
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 3d509fa2827..d4ea7aec44d 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../../makesdna
../../makesrna
../../windowmanager
+ ../../gpu
../../../../intern/guardedalloc
)
@@ -40,6 +41,7 @@ set(INC_SYS
)
set(SRC
+ gpu.c
bpy.c
bpy_app.c
bpy_app_handlers.c
@@ -58,6 +60,7 @@ set(SRC
bpy_util.c
stubs.c
+ gpu.h
bpy.h
bpy_app.h
bpy_app_handlers.h
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index e7e46160199..b909a0d5f55 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -63,7 +63,7 @@ static PyStructSequence_Desc app_cb_info_desc= {
#endif
*/
-static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0};
+static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL};
static PyObject *make_app_cb_info(void)
{
@@ -102,7 +102,7 @@ PyObject *BPY_app_handlers_struct(void)
/* assign the C callbacks */
if(ret) {
- static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}};
+ static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}};
bCallbackFuncStore *funcstore;
int pos= 0;
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index d68fd9a9111..f3ef55d29c4 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -76,6 +76,13 @@ int bpy_pydriver_create_dict(void)
Py_DECREF(mod);
}
+ /* add noise to global namespace */
+ mod= PyImport_ImportModuleLevel((char *)"noise", NULL, NULL, NULL, 0);
+ if (mod) {
+ PyDict_SetItemString(bpy_pydriver_Dict, "noise", mod);
+ Py_DECREF(mod);
+ }
+
return 0;
}
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index d5615f5ab2d..3182836bf42 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -40,6 +40,7 @@
#include "RNA_types.h"
#include "bpy.h"
+#include "gpu.h"
#include "bpy_rna.h"
#include "bpy_util.h"
#include "bpy_traceback.h"
@@ -186,6 +187,7 @@ static struct _inittab bpy_internal_modules[]= {
#ifdef WITH_CYCLES
{(char *)"libcycles_blender", CYCLES_initPython},
#endif
+ {(char *)"gpu", GPU_initPython},
{NULL, NULL}
};
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 6de3c040c18..a63cee4e505 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1525,10 +1525,22 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
#endif // USE_STRING_COERCE
if (param==NULL) {
- PyErr_Format(PyExc_TypeError,
- "%.200s %.200s.%.200s expected a string type, not %.200s",
- error_prefix, RNA_struct_identifier(ptr->type),
- RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+ if(PyUnicode_Check(value)) {
+ /* there was an error assigning a string type,
+ * rather than setting a new error, prefix the existing one
+ */
+ PyC_Err_Format_Prefix(PyExc_TypeError,
+ "%.200s %.200s.%.200s error assigning string",
+ error_prefix, RNA_struct_identifier(ptr->type),
+ RNA_property_identifier(prop));
+ }
+ else {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s %.200s.%.200s expected a string type, not %.200s",
+ error_prefix, RNA_struct_identifier(ptr->type),
+ RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+ }
+
return -1;
}
else {
@@ -4608,7 +4620,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#ifdef DEBUG_STRING_FREE
- // if(PyList_Size(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_Size(string_free_ls));
+ // if(PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls));
Py_DECREF(string_free_ls);
#undef DEBUG_STRING_FREE
#endif
@@ -4631,28 +4643,28 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
/* note: tp_base member is set to &PyType_Type on init */
PyTypeObject pyrna_struct_meta_idprop_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_struct_meta_idprop", /* tp_name */
- sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's
- 0, /* tp_itemsize */
+ "bpy_struct_meta_idprop", /* tp_name */
+ sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's
+ 0, /* tp_itemsize */
/* methods */
- NULL, /* tp_dealloc */
+ NULL, /* tp_dealloc */
NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* deprecated in python 3.0! */
- NULL, /* tp_repr */
+ NULL, /* getattrfunc tp_getattr; */
+ NULL, /* setattrfunc tp_setattr; */
+ NULL, /* tp_compare */ /* deprecated in python 3.0! */
+ NULL, /* tp_repr */
/* Method suites for standard classes */
NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- NULL /*(getattrofunc) pyrna_struct_meta_idprop_getattro*/, /* getattrofunc tp_getattro; */
- (setattrofunc) pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */
+ NULL, /* hashfunc tp_hash; */
+ NULL, /* ternaryfunc tp_call; */
+ NULL, /* reprfunc tp_str; */
+ NULL /*(getattrofunc) pyrna_struct_meta_idprop_getattro*/, /* getattrofunc tp_getattro; */
+ (setattrofunc) pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
@@ -4660,7 +4672,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= {
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -4670,7 +4682,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- NULL, /* richcmpfunc tp_richcompare; */
+ NULL, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0, /* long tp_weaklistoffset; */
@@ -4681,9 +4693,9 @@ PyTypeObject pyrna_struct_meta_idprop_Type= {
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- NULL, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
+ NULL, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -4691,7 +4703,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= {
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- NULL, /* newfunc tp_new; */
+ NULL, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
@@ -4709,45 +4721,45 @@ PyTypeObject pyrna_struct_meta_idprop_Type= {
/*-----------------------BPy_StructRNA method def------------------------------*/
PyTypeObject pyrna_struct_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_struct", /* tp_name */
- sizeof(BPy_StructRNA), /* tp_basicsize */
- 0, /* tp_itemsize */
+ "bpy_struct", /* tp_name */
+ sizeof(BPy_StructRNA), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
(destructor) pyrna_struct_dealloc,/* tp_dealloc */
NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
- NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
- (reprfunc) pyrna_struct_repr, /* tp_repr */
+ NULL, /* getattrfunc tp_getattr; */
+ NULL, /* setattrfunc tp_setattr; */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ (reprfunc) pyrna_struct_repr, /* tp_repr */
/* Method suites for standard classes */
NULL, /* PyNumberMethods *tp_as_number; */
- &pyrna_struct_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- &pyrna_struct_as_mapping, /* PyMappingMethods *tp_as_mapping; */
+ &pyrna_struct_as_sequence, /* PySequenceMethods *tp_as_sequence; */
+ &pyrna_struct_as_mapping, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- (hashfunc) pyrna_struct_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
+ (hashfunc) pyrna_struct_hash, /* hashfunc tp_hash; */
+ NULL, /* ternaryfunc tp_call; */
(reprfunc) pyrna_struct_str, /* reprfunc tp_str; */
- (getattrofunc) pyrna_struct_getattro, /* getattrofunc tp_getattro; */
- (setattrofunc) pyrna_struct_setattro, /* setattrofunc tp_setattro; */
+ (getattrofunc) pyrna_struct_getattro, /* getattrofunc tp_getattro; */
+ (setattrofunc) pyrna_struct_setattro, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
/*** Flags to define presence of optional/expanded features ***/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* long tp_flags; */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
#ifdef USE_PYRNA_STRUCT_REFERENCE
- (traverseproc) pyrna_struct_traverse, /* traverseproc tp_traverse; */
+ (traverseproc) pyrna_struct_traverse, /* traverseproc tp_traverse; */
/* delete references to contained objects */
- (inquiry)pyrna_struct_clear, /* inquiry tp_clear; */
+ (inquiry)pyrna_struct_clear, /* inquiry tp_clear; */
#else
NULL, /* traverseproc tp_traverse; */
@@ -4757,11 +4769,11 @@ PyTypeObject pyrna_struct_Type= {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- (richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */
+ (richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
#ifdef USE_WEAKREFS
- offsetof(BPy_StructRNA, in_weakreflist), /* long tp_weaklistoffset; */
+ offsetof(BPy_StructRNA, in_weakreflist), /* long tp_weaklistoffset; */
#else
0,
#endif
@@ -4771,9 +4783,9 @@ PyTypeObject pyrna_struct_Type= {
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- pyrna_struct_methods, /* struct PyMethodDef *tp_methods; */
+ pyrna_struct_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- pyrna_struct_getseters, /* struct PyGetSetDef *tp_getset; */
+ pyrna_struct_getseters, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -4781,7 +4793,7 @@ PyTypeObject pyrna_struct_Type= {
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- pyrna_struct_new, /* newfunc tp_new; */
+ pyrna_struct_new, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
@@ -4798,32 +4810,32 @@ PyTypeObject pyrna_struct_Type= {
/*-----------------------BPy_PropertyRNA method def------------------------------*/
PyTypeObject pyrna_prop_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_prop", /* tp_name */
- sizeof(BPy_PropertyRNA), /* tp_basicsize */
- 0, /* tp_itemsize */
+ "bpy_prop", /* tp_name */
+ sizeof(BPy_PropertyRNA), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
(destructor) pyrna_prop_dealloc, /* tp_dealloc */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
+ NULL, /* printfunc tp_print; */
+ NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
- (reprfunc) pyrna_prop_repr, /* tp_repr */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ (reprfunc) pyrna_prop_repr, /* tp_repr */
/* Method suites for standard classes */
NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- (hashfunc) pyrna_prop_hash, /* hashfunc tp_hash; */
+ (hashfunc) pyrna_prop_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
(reprfunc) pyrna_prop_str, /* reprfunc tp_str; */
/* will only use these if this is a subtype of a py class */
- NULL, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
@@ -4831,7 +4843,7 @@ PyTypeObject pyrna_prop_Type= {
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -4852,11 +4864,11 @@ PyTypeObject pyrna_prop_Type= {
/*** Added in release 2.2 ***/
/* Iterators */
- NULL, /* getiterfunc tp_iter; */
+ NULL, /* getiterfunc tp_iter; */
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */
+ pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
pyrna_prop_getseters, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
@@ -4866,7 +4878,7 @@ PyTypeObject pyrna_prop_Type= {
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- pyrna_prop_new, /* newfunc tp_new; */
+ pyrna_prop_new, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
@@ -4888,34 +4900,34 @@ PyTypeObject pyrna_prop_array_Type= {
/* methods */
(destructor)pyrna_prop_array_dealloc, /* tp_dealloc */
NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
+ NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
NULL,/* subclassed */ /* tp_repr */
/* Method suites for standard classes */
- &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */
- &pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- &pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */
+ &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */
+ &pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */
+ &pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ NULL, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
/* will only use these if this is a subtype of a py class */
- (getattrofunc) pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
+ (getattrofunc) pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
/*** Flags to define presence of optional/expanded features ***/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -4925,7 +4937,7 @@ PyTypeObject pyrna_prop_array_Type= {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */
+ NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
#ifdef USE_WEAKREFS
@@ -4939,22 +4951,22 @@ PyTypeObject pyrna_prop_array_Type= {
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- pyrna_prop_array_methods, /* struct PyMethodDef *tp_methods; */
+ pyrna_prop_array_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
- &pyrna_prop_Type, /* struct _typeobject *tp_base; */
+ NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ &pyrna_prop_Type, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
NULL, /* descrsetfunc tp_descr_set; */
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- NULL, /* newfunc tp_new; */
+ NULL, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
NULL, /* inquiry tp_is_gc; */
- NULL, /* PyObject *tp_bases; */
+ NULL, /* PyObject *tp_bases; */
/* method resolution order */
NULL, /* PyObject *tp_mro; */
NULL, /* PyObject *tp_cache; */
@@ -4965,32 +4977,32 @@ PyTypeObject pyrna_prop_array_Type= {
PyTypeObject pyrna_prop_collection_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_prop_collection", /* tp_name */
- sizeof(BPy_PropertyRNA), /* tp_basicsize */
- 0, /* tp_itemsize */
+ "bpy_prop_collection", /* tp_name */
+ sizeof(BPy_PropertyRNA), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
(destructor)pyrna_prop_dealloc, /* tp_dealloc */
NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
+ NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
NULL, /* subclassed */ /* tp_repr */
/* Method suites for standard classes */
&pyrna_prop_collection_as_number, /* PyNumberMethods *tp_as_number; */
- &pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */
- &pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */
+ &pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */
+ &pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ NULL, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
/* will only use these if this is a subtype of a py class */
- (getattrofunc) pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */
- (setattrofunc) pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */
+ (getattrofunc) pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */
+ (setattrofunc) pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
@@ -4998,7 +5010,7 @@ PyTypeObject pyrna_prop_collection_Type= {
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -5012,33 +5024,33 @@ PyTypeObject pyrna_prop_collection_Type= {
/*** weak reference enabler ***/
#ifdef USE_WEAKREFS
- offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */
+ offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */
#else
0,
#endif
/*** Added in release 2.2 ***/
/* Iterators */
- (getiterfunc)pyrna_prop_collection_iter, /* getiterfunc tp_iter; */
+ (getiterfunc)pyrna_prop_collection_iter, /* getiterfunc tp_iter; */
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- pyrna_prop_collection_methods, /* struct PyMethodDef *tp_methods; */
+ pyrna_prop_collection_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
- &pyrna_prop_Type, /* struct _typeobject *tp_base; */
+ NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ &pyrna_prop_Type, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
NULL, /* descrsetfunc tp_descr_set; */
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- NULL, /* newfunc tp_new; */
+ NULL, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
NULL, /* inquiry tp_is_gc; */
- NULL, /* PyObject *tp_bases; */
+ NULL, /* PyObject *tp_bases; */
/* method resolution order */
NULL, /* PyObject *tp_mro; */
NULL, /* PyObject *tp_cache; */
@@ -5050,32 +5062,32 @@ PyTypeObject pyrna_prop_collection_Type= {
/* only for add/remove/move methods */
static PyTypeObject pyrna_prop_collection_idprop_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_prop_collection_idprop", /* tp_name */
- sizeof(BPy_PropertyRNA), /* tp_basicsize */
- 0, /* tp_itemsize */
+ "bpy_prop_collection_idprop", /* tp_name */
+ sizeof(BPy_PropertyRNA), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
(destructor)pyrna_prop_dealloc, /* tp_dealloc */
NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
+ NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
- NULL, /* subclassed */ /* tp_repr */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ NULL, /* subclassed */ /* tp_repr */
/* Method suites for standard classes */
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
+ NULL, /* PyNumberMethods *tp_as_number; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ NULL, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
/* will only use these if this is a subtype of a py class */
- NULL, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
@@ -5083,7 +5095,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= {
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -5097,33 +5109,33 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= {
/*** weak reference enabler ***/
#ifdef USE_WEAKREFS
- offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */
+ offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */
#else
0,
#endif
/*** Added in release 2.2 ***/
/* Iterators */
- NULL, /* getiterfunc tp_iter; */
+ NULL, /* getiterfunc tp_iter; */
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
- &pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */
+ NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ &pyrna_prop_collection_Type,/* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
NULL, /* descrsetfunc tp_descr_set; */
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- NULL, /* newfunc tp_new; */
+ NULL, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
NULL, /* inquiry tp_is_gc; */
- NULL, /* PyObject *tp_bases; */
+ NULL, /* PyObject *tp_bases; */
/* method resolution order */
NULL, /* PyObject *tp_mro; */
NULL, /* PyObject *tp_cache; */
@@ -5135,32 +5147,32 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= {
/*-----------------------BPy_PropertyRNA method def------------------------------*/
PyTypeObject pyrna_func_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_func", /* tp_name */
- sizeof(BPy_FunctionRNA), /* tp_basicsize */
- 0, /* tp_itemsize */
+ "bpy_func", /* tp_name */
+ sizeof(BPy_FunctionRNA), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
- NULL, /* tp_dealloc */
- NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
+ NULL, /* tp_dealloc */
+ NULL, /* printfunc tp_print; */
+ NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
- (reprfunc) pyrna_func_repr, /* tp_repr */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ (reprfunc) pyrna_func_repr, /* tp_repr */
/* Method suites for standard classes */
NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
- (ternaryfunc)pyrna_func_call, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
+ NULL, /* hashfunc tp_hash; */
+ (ternaryfunc)pyrna_func_call, /* ternaryfunc tp_call; */
+ NULL, /* reprfunc tp_str; */
/* will only use these if this is a subtype of a py class */
- NULL, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
@@ -5168,7 +5180,7 @@ PyTypeObject pyrna_func_Type= {
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -5178,7 +5190,7 @@ PyTypeObject pyrna_func_Type= {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- NULL, /* richcmpfunc tp_richcompare; */
+ NULL, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
#ifdef USE_WEAKREFS
@@ -5189,13 +5201,13 @@ PyTypeObject pyrna_func_Type= {
/*** Added in release 2.2 ***/
/* Iterators */
- NULL, /* getiterfunc tp_iter; */
+ NULL, /* getiterfunc tp_iter; */
NULL, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- NULL, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
+ NULL, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -5203,7 +5215,7 @@ PyTypeObject pyrna_func_Type= {
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- NULL, /* newfunc tp_new; */
+ NULL, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
@@ -5231,32 +5243,32 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *
PyTypeObject pyrna_prop_collection_iter_Type= {
PyVarObject_HEAD_INIT(NULL, 0)
- "bpy_prop_collection_iter", /* tp_name */
- sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */
- 0, /* tp_itemsize */
+ "bpy_prop_collection_iter", /* tp_name */
+ sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
(destructor)pyrna_prop_collection_iter_dealloc, /* tp_dealloc */
NULL, /* printfunc tp_print; */
- NULL, /* getattrfunc tp_getattr; */
+ NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
NULL,/* subclassed */ /* tp_repr */
/* Method suites for standard classes */
NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ NULL, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
/* will only use these if this is a subtype of a py class */
- PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
+ PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
@@ -5264,7 +5276,7 @@ PyTypeObject pyrna_prop_collection_iter_Type= {
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
- NULL, /* char *tp_doc; Documentation string */
+ NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
@@ -5278,19 +5290,19 @@ PyTypeObject pyrna_prop_collection_iter_Type= {
/*** weak reference enabler ***/
#ifdef USE_WEAKREFS
- offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), /* long tp_weaklistoffset; */
+ offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), /* long tp_weaklistoffset; */
#else
0,
#endif
/*** Added in release 2.2 ***/
/* Iterators */
- PyObject_SelfIter, /* getiterfunc tp_iter; */
- (iternextfunc) pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */
+ PyObject_SelfIter, /* getiterfunc tp_iter; */
+ (iternextfunc) pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
- NULL, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL, /* struct PyGetSetDef *tp_getset; */
+ NULL, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -5298,12 +5310,12 @@ PyTypeObject pyrna_prop_collection_iter_Type= {
0, /* long tp_dictoffset; */
NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
- NULL, /* newfunc tp_new; */
+ NULL, /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL, /* freefunc tp_free; */
/* For PyObject_IS_GC */
NULL, /* inquiry tp_is_gc; */
- NULL, /* PyObject *tp_bases; */
+ NULL, /* PyObject *tp_bases; */
/* method resolution order */
NULL, /* PyObject *tp_mro; */
NULL, /* PyObject *tp_cache; */
@@ -5443,7 +5455,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
if(bpy_types==NULL) {
PyErr_Print();
PyErr_Clear();
- fprintf(stderr, "pyrna_srna_ExternalType: failed to find 'bpy_types' module\n");
+ fprintf(stderr, "%s: failed to find 'bpy_types' module\n", __func__);
return NULL;
}
bpy_types_dict= PyModule_GetDict(bpy_types); // borrow
@@ -5457,18 +5469,18 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
PyObject *base_compare= pyrna_srna_PyBase(srna);
//PyObject *slots= PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values!
//PyObject *bases= PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to.
- PyObject *bases= ((PyTypeObject *)newclass)->tp_bases;
- PyObject *slots= PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__);
+ PyObject *tp_bases= ((PyTypeObject *)newclass)->tp_bases;
+ PyObject *tp_slots= PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__);
- if(slots==NULL) {
- fprintf(stderr, "pyrna_srna_ExternalType: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", idname);
+ if(tp_slots==NULL) {
+ fprintf(stderr, "%s: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", __func__, idname);
newclass= NULL;
}
- else if(PyTuple_GET_SIZE(bases)) {
- PyObject *base= PyTuple_GET_ITEM(bases, 0);
+ else if(PyTuple_GET_SIZE(tp_bases)) {
+ PyObject *base= PyTuple_GET_ITEM(tp_bases, 0);
if(base_compare != base) {
- fprintf(stderr, "pyrna_srna_ExternalType: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", idname);
+ fprintf(stderr, "%s: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", __func__, idname);
PyC_ObSpit("Expected! ", base_compare);
newclass= NULL;
}
@@ -5538,7 +5550,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
}
else {
/* this should not happen */
- printf("Error registering '%s'\n", idname);
+ printf("%s: error registering '%s'\n", __func__, idname);
PyErr_Print();
PyErr_Clear();
}
@@ -5581,7 +5593,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
Py_DECREF(tp); /* srna owns, cant hold a ref */
}
else {
- fprintf(stderr, "Could not make type\n");
+ fprintf(stderr, "%s: could not make type\n", __func__);
pyrna= (BPy_StructRNA *) PyObject_GC_New(BPy_StructRNA, &pyrna_struct_Type);
#ifdef USE_WEAKREFS
pyrna->in_weakreflist= NULL;
@@ -6231,10 +6243,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
#endif
py_class= RNA_struct_py_type_get(ptr->type);
-
/* rare case. can happen when registering subclasses */
if(py_class==NULL) {
- fprintf(stderr, "bpy_class_call(): unable to get python class for rna struct '%.200s'\n", RNA_struct_identifier(ptr->type));
+ fprintf(stderr, "%s: unable to get python class for rna struct '%.200s'\n",
+ __func__, RNA_struct_identifier(ptr->type));
return -1;
}
@@ -6427,14 +6439,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
* no line number since the func has finished calling on error,
* re-raise the exception with more info since it would be slow to
* create prefix on every call (when there are no errors) */
- if(err == -1 && PyErr_Occurred()) {
- PyObject *error_type, *error_value, *error_traceback;
- PyErr_Fetch(&error_type, &error_value, &error_traceback);
-
- PyErr_Format(error_type,
- "class %.200s, function %.200s: incompatible return value%S",
- RNA_struct_identifier(ptr->type), RNA_function_identifier(func),
- error_value);
+ if(err == -1) {
+ PyC_Err_Format_Prefix(PyExc_RuntimeError,
+ "class %.200s, function %.200s: incompatible return value ",
+ RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
+ );
}
}
else if (ret_len > 1) {
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
new file mode 100644
index 00000000000..8fa6a7b0629
--- /dev/null
+++ b/source/blender/python/intern/gpu.c
@@ -0,0 +1,291 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Benoit Bolsee.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/intern/gpu.c
+ * \ingroup pythonintern
+ */
+
+/* python redefines */
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#include <Python.h>
+
+#include "GPU_material.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_image_types.h"
+#include "DNA_material_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_object_types.h"
+#include "DNA_ID.h"
+#include "DNA_customdata_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
+#include "RNA_access.h"
+
+#include "bpy_rna.h"
+
+#include "gpu.h"
+
+#define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, #name, name)
+
+PyDoc_STRVAR(M_gpu_doc,
+ "This module provides access to the GLSL shader.");
+
+static struct PyModuleDef gpumodule = {
+ PyModuleDef_HEAD_INIT,
+ "gpu", /* name of module */
+ M_gpu_doc, /* module documentation */
+ -1, /* size of per-interpreter state of the module,
+ or -1 if the module keeps state in global variables. */
+ NULL, NULL, NULL, NULL, NULL
+};
+
+PyMODINIT_FUNC
+PyInit_gpu(void)
+{
+ PyObject* m;
+
+ m = PyModule_Create(&gpumodule);
+ if(m == NULL)
+ return NULL;
+
+ // device constants
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWMAT);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_MAT);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWIMAT);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_IMAT);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_COLOR);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNVEC);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNCO);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNIMAT);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNPERSMAT);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNENERGY);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNCOL);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DBUFFER);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DIMAGE);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DSHADOW);
+
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_1I);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_1F);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_2F);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_3F);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_4F);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_9F);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_16F);
+ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_4UB);
+
+ PY_MODULE_ADD_CONSTANT(m, CD_MTFACE);
+ PY_MODULE_ADD_CONSTANT(m, CD_ORCO);
+ PY_MODULE_ADD_CONSTANT(m, CD_TANGENT);
+ PY_MODULE_ADD_CONSTANT(m, CD_MCOL);
+ return m;
+}
+
+#define PY_DICT_ADD_STRING(d,s,f) \
+ val = PyUnicode_FromString(s->f); \
+ PyDict_SetItemString(d, #f, val); \
+ Py_DECREF(val)
+
+#define PY_DICT_ADD_LONG(d,s,f) \
+ val = PyLong_FromLong(s->f); \
+ PyDict_SetItemString(d, #f, val); \
+ Py_DECREF(val)
+
+#define PY_DICT_ADD_ID(d,s,f) \
+ RNA_id_pointer_create((struct ID*)s->f, &tptr); \
+ val = pyrna_struct_CreatePyObject(&tptr); \
+ PyDict_SetItemString(d, #f, val); \
+ Py_DECREF(val)
+
+#define PY_OBJ_ADD_ID(d,s,f) \
+ val = PyUnicode_FromString(&s->f->id.name[2]); \
+ PyObject_SetAttrString(d, #f, val); \
+ Py_DECREF(val)
+
+#define PY_OBJ_ADD_LONG(d,s,f) \
+ val = PyLong_FromLong(s->f); \
+ PyObject_SetAttrString(d, #f, val); \
+ Py_DECREF(val)
+
+#define PY_OBJ_ADD_STRING(d,s,f) \
+ val = PyUnicode_FromString(s->f); \
+ PyObject_SetAttrString(d, #f, val); \
+ Py_DECREF(val)
+
+static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
+{
+ PyObject* pyscene;
+ PyObject* pymat;
+ PyObject* as_pointer;
+ PyObject* pointer;
+ PyObject* result;
+ PyObject* dict;
+ PyObject* val;
+ PyObject* seq;
+
+ int i;
+ Scene *scene;
+ PointerRNA tptr;
+ Material *material;
+ GPUShaderExport *shader;
+ GPUInputUniform *uniform;
+ GPUInputAttribute *attribute;
+
+ static const char *kwlist[] = {"scene", "material", NULL};
+
+ if(!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat))
+ return NULL;
+
+ if (!strcmp(Py_TYPE(pyscene)->tp_name, "Scene") &&
+ (as_pointer = PyObject_GetAttrString(pyscene, "as_pointer")) != NULL &&
+ PyCallable_Check(as_pointer)) {
+ // must be a scene object
+ pointer = PyObject_CallObject(as_pointer, NULL);
+ if (!pointer) {
+ PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
+ return NULL;
+ }
+ scene = (Scene*)PyLong_AsVoidPtr(pointer);
+ Py_DECREF(pointer);
+ if (!scene) {
+ PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
+ return NULL;
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError, "gpu.export_shader() first argument should be of Scene type");
+ return NULL;
+ }
+
+ if (!strcmp(Py_TYPE(pymat)->tp_name, "Material") &&
+ (as_pointer = PyObject_GetAttrString(pymat, "as_pointer")) != NULL &&
+ PyCallable_Check(as_pointer)) {
+ // must be a material object
+ pointer = PyObject_CallObject(as_pointer, NULL);
+ if (!pointer) {
+ PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
+ return NULL;
+ }
+ material = (Material*)PyLong_AsVoidPtr(pointer);
+ Py_DECREF(pointer);
+ if (!material) {
+ PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
+ return NULL;
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError, "gpu.export_shader() second argument should be of Material type");
+ return NULL;
+ }
+ // we can call our internal function at last:
+ shader = GPU_shader_export(scene, material);
+ if (!shader) {
+ PyErr_SetString(PyExc_RuntimeError, "cannot export shader");
+ return NULL;
+ }
+ // build a dictionary
+ result = PyDict_New();
+ if (shader->fragment) {
+ PY_DICT_ADD_STRING(result,shader,fragment);
+ }
+ if (shader->vertex) {
+ PY_DICT_ADD_STRING(result,shader,vertex);
+ }
+ seq = PyList_New(BLI_countlist(&shader->uniforms));
+ for (i=0, uniform=shader->uniforms.first; uniform; uniform=uniform->next, i++) {
+ dict = PyDict_New();
+ PY_DICT_ADD_STRING(dict,uniform,varname);
+ PY_DICT_ADD_LONG(dict,uniform,datatype);
+ PY_DICT_ADD_LONG(dict,uniform,type);
+ if (uniform->lamp) {
+ PY_DICT_ADD_ID(dict,uniform,lamp);
+ }
+ if (uniform->image) {
+ PY_DICT_ADD_ID(dict,uniform,image);
+ }
+ if (uniform->type == GPU_DYNAMIC_SAMPLER_2DBUFFER ||
+ uniform->type == GPU_DYNAMIC_SAMPLER_2DIMAGE ||
+ uniform->type == GPU_DYNAMIC_SAMPLER_2DSHADOW) {
+ PY_DICT_ADD_LONG(dict,uniform,texnumber);
+ }
+ if (uniform->texpixels) {
+ val = PyByteArray_FromStringAndSize((const char *)uniform->texpixels, uniform->texsize);
+ PyDict_SetItemString(dict, "texpixels", val);
+ Py_DECREF(val);
+ PY_DICT_ADD_LONG(dict,uniform,texsize);
+ }
+ PyList_SET_ITEM(seq, i, dict);
+ }
+ PyDict_SetItemString(result, "uniforms", seq);
+ Py_DECREF(seq);
+
+ seq = PyList_New(BLI_countlist(&shader->attributes));
+ for (i=0, attribute=shader->attributes.first; attribute; attribute=attribute->next, i++) {
+ dict = PyDict_New();
+ PY_DICT_ADD_STRING(dict,attribute,varname);
+ PY_DICT_ADD_LONG(dict,attribute,datatype);
+ PY_DICT_ADD_LONG(dict,attribute,type);
+ PY_DICT_ADD_LONG(dict,attribute,number);
+ if (attribute->name) {
+ if (attribute->name[0] != 0) {
+ PY_DICT_ADD_STRING(dict,attribute,name);
+ } else {
+ val = PyLong_FromLong(0);
+ PyDict_SetItemString(dict, "name", val);
+ Py_DECREF(val);
+ }
+ }
+ PyList_SET_ITEM(seq, i, dict);
+ }
+ PyDict_SetItemString(result, "attributes", seq);
+ Py_DECREF(seq);
+
+ GPU_free_shader_export(shader);
+
+ return result;
+}
+
+static PyMethodDef meth_export_shader[] = {{ "export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS,
+ "export_shader(scene,material)\n\n"
+ "Returns the GLSL shader that produces the visual effect of material in scene.\n\n"
+ ":return: Dictionary defining the shader, uniforms and attributes.\n"
+ ":rtype: Dict"}};
+
+PyObject* GPU_initPython(void)
+{
+ PyObject* module = PyInit_gpu();
+ PyModule_AddObject(module, "export_shader", (PyObject *)PyCFunction_New(meth_export_shader, NULL));
+ PyDict_SetItemString(PyImport_GetModuleDict(), "gpu", module);
+
+ return module;
+}
+
diff --git a/source/blender/python/intern/gpu.h b/source/blender/python/intern/gpu.h
new file mode 100644
index 00000000000..d604c7c6201
--- /dev/null
+++ b/source/blender/python/intern/gpu.h
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This shader is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This shader is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this shader; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Benoit Bolsee.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/intern/gpu.h
+ * \ingroup pythonintern
+ */
+
+/**
+ * Initalizes the gpu Python module.
+ */
+PyObject* GPU_initPython(void);
+
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index bcdfe020e1a..0394d732ae3 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -983,7 +983,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
{
- int len, i;
+ Py_ssize_t len, i;
PyObject *list_item, *item_1, *item_2;
boxPack *box;
@@ -995,14 +995,14 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
return -1;
}
- len= PyList_Size(value);
+ len= PyList_GET_SIZE(value);
(*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box");
for(i= 0; i < len; i++) {
list_item= PyList_GET_ITEM(value, i);
- if(!PyList_Check(list_item) || PyList_Size(list_item) < 4) {
+ if(!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
MEM_freeN(*boxarray);
PyErr_SetString(PyExc_TypeError,
"can only pack a list of [x, y, w, h]");
@@ -1034,11 +1034,11 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
{
- int len, i;
+ Py_ssize_t len, i;
PyObject *list_item;
boxPack *box;
- len= PyList_Size(value);
+ len= PyList_GET_SIZE(value);
for(i= 0; i < len; i++) {
box= (*boxarray)+i;
@@ -1062,7 +1062,7 @@ PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
{
float tot_width= 0.0f, tot_height= 0.0f;
- int len;
+ Py_ssize_t len;
PyObject *ret;