diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-31 04:59:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-31 04:59:17 +0400 |
commit | 5b88712ff932fcbcd0bb0fb257e8e9c2e247a82a (patch) | |
tree | ca0f15ee78fee5aef80ebf5c0f9f46529b65a9e2 /source/blender/python/intern/bpy_app.c | |
parent | ebb229110e4af5d2df5613b6345da2f602b90092 (diff) |
move debug flag into its own global var (G.debug), split up debug options.
--debug
--debug-ffmpeg
--debug-python
--debug-events
--debug-wm
This makes debug output easier to read - event debug prints would flood output too much before.
For convenience:
--debug-all turns all debug flags on (works as --debug did before).
also removed some redundant whitespace in debug prints and prefix some prints with __func__ to give some context.
Diffstat (limited to 'source/blender/python/intern/bpy_app.c')
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index aab1f508e32..44979700d94 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -166,24 +166,26 @@ static PyObject *make_app_info(void) * they are not static */ PyDoc_STRVAR(bpy_app_debug_doc, -"Boolean, set when blender is running in debug mode (started with --debug)" +"Boolean, for debug info (started with --debug / --debug_* matching this attribute name)" ); -static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)) +static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *closure) { - return PyBool_FromLong(G.f & G_DEBUG); + const int flag = GET_INT_FROM_POINTER(closure); + return PyBool_FromLong(G.debug & flag); } -static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) +static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *closure) { - int param = PyObject_IsTrue(value); + const int flag = GET_INT_FROM_POINTER(closure); + const int param = PyObject_IsTrue(value); if (param < 0) { PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); return -1; } - if (param) G.f |= G_DEBUG; - else G.f &= ~G_DEBUG; + if (param) G.debug |= flag; + else G.debug &= ~flag; return 0; } @@ -236,7 +238,12 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl static PyGetSetDef bpy_app_getsets[] = { - {(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, NULL}, + {(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG}, + {(char *)"debug_ffmpeg", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_FFMPEG}, + {(char *)"debug_python", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_PYTHON}, + {(char *)"debug_events", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_EVENTS}, + {(char *)"debug_wm", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_WM}, + {(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL}, {(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)bpy_app_tempdir_doc, NULL}, {(char *)"driver_namespace", bpy_app_driver_dict_get, NULL, (char *)bpy_app_driver_dict_doc, NULL}, |