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:
authorCampbell Barton <ideasman42@gmail.com>2012-03-31 04:59:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-31 04:59:17 +0400
commit5b88712ff932fcbcd0bb0fb257e8e9c2e247a82a (patch)
treeca0f15ee78fee5aef80ebf5c0f9f46529b65a9e2 /source/blender/python
parentebb229110e4af5d2df5613b6345da2f602b90092 (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')
-rw-r--r--source/blender/python/intern/bpy_app.c23
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c6
-rw-r--r--source/blender/python/intern/bpy_rna_array.c2
4 files changed, 20 insertions, 13 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},
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 61b3f7b1575..7b362e56c73 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -696,7 +696,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
else printf("PyContext '%s' not found\n", member);
}
else {
- if (G.f & G_DEBUG) {
+ if (G.debug & G_DEBUG_PYTHON) {
printf("PyContext '%s' found\n", member);
}
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 1f284ae01cb..7af53b489bd 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -6033,7 +6033,7 @@ static PyObject *pyrna_srna_ExternalType(StructRNA *srna)
newclass = NULL;
}
else {
- if (G.f & G_DEBUG)
+ if (G.debug & G_DEBUG_PYTHON)
fprintf(stderr, "SRNA Subclassed: '%s'\n", idname);
}
}
@@ -7145,7 +7145,7 @@ static void bpy_class_free(void *pyob_ptr)
PyErr_Clear();
#if 0 /* needs further investigation, too annoying so quiet for now */
- if (G.f & G_DEBUG) {
+ if (G.debug & G_DEBUG_PYTHON) {
if (self->ob_refcnt > 1) {
PyC_ObSpit("zombie class - ref should be 1", self);
}
@@ -7444,7 +7444,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
}
/* should happen all the time but very slow */
- if (G.f & G_DEBUG) {
+ if (G.debug & G_DEBUG_PYTHON) {
/* remove all properties using this class */
StructRNA *srna_iter;
PointerRNA ptr_rna;
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 8d8219df188..5c59c1e620a 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -664,7 +664,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
len = RNA_property_multi_array_length(ptr, prop, arraydim);
if (index >= len || index < 0) {
/* this shouldn't happen because higher level funcs must check for invalid index */
- if (G.f & G_DEBUG) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len);
+ if (G.debug & G_DEBUG_PYTHON) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len);
PyErr_SetString(PyExc_IndexError, "out of range");
return NULL;