[Bf-blender-cvs] [69a77a1b836] master: Fix class registration ignoring info/warnings
Campbell Barton
noreply at git.blender.org
Wed Mar 27 04:06:46 CET 2019
Commit: 69a77a1b83639189f2bbb54a198907192086eb26
Author: Campbell Barton
Date: Wed Mar 27 14:03:16 2019 +1100
Branches: master
https://developer.blender.org/rB69a77a1b83639189f2bbb54a198907192086eb26
Fix class registration ignoring info/warnings
Only errors were displayed in the console.
===================================================================
M source/blender/python/intern/bpy_rna.c
===================================================================
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 */
More information about the Bf-blender-cvs
mailing list