access bpy.app.debug_value, G.rt internally

This commit is contained in:
Campbell Barton 2010-12-15 06:03:45 +00:00
parent eb8458b064
commit 97aa2287fa

@ -153,6 +153,25 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUS
return 0; 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)) static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
{ {
extern char btempdir[]; extern char btempdir[];
@ -174,6 +193,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl
PyGetSetDef bpy_app_getsets[]= { 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", 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 *)"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}, {(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} {NULL, NULL, NULL, NULL, NULL}