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:
authorMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
committerMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
commit2ed6f077b3952123d56916980d18a379ecb3e5ac (patch)
tree1aa273e5566c95214739fb224d4c6cf115417882 /source/blender/python/intern/bpy_props.c
parentb9c83456b27da57a14bcf8d274b460e670d49990 (diff)
parent62f22185546e80b661424b45c88006f8b592d8b1 (diff)
Merge with trunk r41545
Diffstat (limited to 'source/blender/python/intern/bpy_props.c')
-rw-r--r--source/blender/python/intern/bpy_props.c96
1 files changed, 52 insertions, 44 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 4b30b4705f4..cfd2e5556a1 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -279,52 +279,60 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
/* this define runs at the start of each function and deals with
* returning a deferred property (to be registered later) */
-#define BPY_PROPDEF_HEAD(_func) \
- if (PyTuple_GET_SIZE(args) == 1) { \
- PyObject *ret; \
- self= PyTuple_GET_ITEM(args, 0); \
- args= PyTuple_New(0); \
- ret= BPy_##_func(self, args, kw); \
- Py_DECREF(args); \
- return ret; \
- } \
- else if (PyTuple_GET_SIZE(args) > 1) { \
- PyErr_SetString(PyExc_ValueError, "all args must be keywords"); \
- return NULL; \
- } \
- srna= srna_from_self(self, #_func"(...):"); \
- if (srna==NULL) { \
- if (PyErr_Occurred()) \
- return NULL; \
- return bpy_prop_deferred_return((void *)pymeth_##_func, kw); \
- } \
+#define BPY_PROPDEF_HEAD(_func) \
+ if (PyTuple_GET_SIZE(args) == 1) { \
+ PyObject *ret; \
+ self= PyTuple_GET_ITEM(args, 0); \
+ args= PyTuple_New(0); \
+ ret= BPy_##_func(self, args, kw); \
+ Py_DECREF(args); \
+ return ret; \
+ } \
+ else if (PyTuple_GET_SIZE(args) > 1) { \
+ PyErr_SetString(PyExc_ValueError, "all args must be keywords"); \
+ return NULL; \
+ } \
+ srna= srna_from_self(self, #_func"(...):"); \
+ if (srna==NULL) { \
+ if (PyErr_Occurred()) \
+ return NULL; \
+ return bpy_prop_deferred_return((void *)pymeth_##_func, kw); \
+ } \
/* terse macros for error checks shared between all funcs cant use function
* calls because of static strins passed to pyrna_set_to_enum_bitfield */
-#define BPY_PROPDEF_CHECK(_func, _property_flag_items) \
- if (id_len >= MAX_IDPROP_NAME) { \
- PyErr_Format(PyExc_TypeError, \
- #_func"(): '%.200s' too long, max length is %d", \
- id, MAX_IDPROP_NAME-1); \
- return NULL; \
- } \
- if (RNA_def_property_free_identifier(srna, id) == -1) { \
- PyErr_Format(PyExc_TypeError, \
- #_func"(): '%s' is defined as a non-dynamic type", \
- id); \
- return NULL; \
- } \
- if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, pyopts, &opts, #_func"(options={...}):")) \
- return NULL; \
-
-#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \
- BPY_PROPDEF_CHECK(_func, _property_flag_items) \
- if (pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \
- PyErr_Format(PyExc_TypeError, \
- #_func"(subtype='%s'): invalid subtype", \
- pysubtype); \
- return NULL; \
- } \
+#define BPY_PROPDEF_CHECK(_func, _property_flag_items) \
+ if (id_len >= MAX_IDPROP_NAME) { \
+ PyErr_Format(PyExc_TypeError, \
+ #_func"(): '%.200s' too long, max length is %d", \
+ id, MAX_IDPROP_NAME-1); \
+ return NULL; \
+ } \
+ if (RNA_def_property_free_identifier(srna, id) == -1) { \
+ PyErr_Format(PyExc_TypeError, \
+ #_func"(): '%s' is defined as a non-dynamic type", \
+ id); \
+ return NULL; \
+ } \
+ if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, \
+ pyopts, \
+ &opts, \
+ #_func"(options={...}):")) \
+ { \
+ return NULL; \
+ } \
+
+#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \
+ BPY_PROPDEF_CHECK(_func, _property_flag_items) \
+ if (pysubtype && RNA_enum_value_from_id(_subtype, \
+ pysubtype, \
+ &subtype)==0) \
+ { \
+ PyErr_Format(PyExc_TypeError, \
+ #_func"(subtype='%s'): invalid subtype", \
+ pysubtype); \
+ return NULL; \
+ } \
#define BPY_PROPDEF_NAME_DOC \
@@ -1211,7 +1219,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
if (!srna) {
if (PyErr_Occurred()) {
PyObject *msg= PyC_ExceptionBuffer();
- char *msg_char= _PyUnicode_AsString(msg);
+ const char *msg_char= _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError,
"%.200s expected an RNA type derived from PropertyGroup, failed with: %s",
error_prefix, msg_char);