diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 06:03:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 06:03:40 +0300 |
commit | 69a77a1b83639189f2bbb54a198907192086eb26 (patch) | |
tree | 3f90299ce6d8be18fd10ce837169290204d95219 /source | |
parent | 9f2665b52624eb1dbf75f479c5d9529ca067f29a (diff) |
Fix class registration ignoring info/warnings
Only errors were displayed in the console.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index cb1555f8cc4..4e96479242b 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -8171,6 +8171,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class StructRNA *srna_new; const char *identifier; PyObject *py_cls_meth; + const char *error_prefix = "register_class(...):"; if (!PyType_Check(py_class)) { PyErr_Format(PyExc_ValueError, @@ -8231,8 +8232,16 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class srna_new = reg(CTX_data_main(C), &reports, py_class, identifier, bpy_class_validate, bpy_class_call, bpy_class_free); - if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) - return NULL; + if (!BLI_listbase_is_empty(&reports.list)) { + const bool has_error = BPy_reports_to_error(&reports, PyExc_RuntimeError, false); + if (!has_error) { + BPy_reports_write_stdout(&reports, error_prefix); + } + BKE_reports_clear(&reports); + if (has_error) { + return NULL; + } + } /* python errors validating are not converted into reports so the check above will fail. * the cause for returning NULL will be printed as an error */ |