diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-15 09:03:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-15 09:03:45 +0300 |
commit | 97aa2287fae49c610fc076a76b26b60e18636880 (patch) | |
tree | ff2115de0a7dd61905a8e661fae8f822fd08fc80 /source/blender/python/intern/bpy_app.c | |
parent | eb8458b064c5a7553a3bd51c214c9669aaf550f9 (diff) |
access bpy.app.debug_value, G.rt internally
Diffstat (limited to 'source/blender/python/intern/bpy_app.c')
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index bbcfef4cd30..0db8ea0f317 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -153,6 +153,25 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUS return 0; } +static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure)) +{ + return PyLong_FromSsize_t(G.rt); +} + +static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) +{ + int param= PyLong_AsSsize_t(value); + + if (param == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number"); + return -1; + } + + G.rt= param; + + return 0; +} + static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) { extern char btempdir[]; @@ -174,6 +193,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl PyGetSetDef bpy_app_getsets[]= { {(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)"Boolean, set when blender is running in debug mode (started with -d)", NULL}, + {(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)"Int, number which can be set to non-zero values for testing purposes.", NULL}, {(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)"String, the temp directory used by blender (read-only)", NULL}, {(char *)"driver_namespace", bpy_app_driver_dict_get, NULL, (char *)"Dictionary for drivers namespace, editable in-place, reset on file load (read-only)", NULL}, {NULL, NULL, NULL, NULL, NULL} |