From 97aa2287fae49c610fc076a76b26b60e18636880 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Dec 2010 06:03:45 +0000 Subject: access bpy.app.debug_value, G.rt internally --- source/blender/python/intern/bpy_app.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/blender/python/intern/bpy_app.c') 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} -- cgit v1.2.3