Fix: T78228 Send all python errors to info editor
Python exceptions are now shown in the info editor, this also resolves an old bug where errors were printed twice. This was originally based on D9752 by @ShadowChaser although many changes have been made from the original patch. Details: - BPy_errors_to_report no longer prints additional output. - BKE_report_print_test was added so it's possible to check if calling BKE_report also printed to the stdout. - Callers to BPy_errors_to_report are responsible for ensuring output is printed to the stdout/stderr. - Python exceptions no longer add a trailing newline, needed to avoid blank-space when displayed in the info-editor.
This commit is contained in:
@@ -27,7 +27,18 @@ bool BPy_errors_to_report_ex(struct ReportList *reports,
|
||||
const char *error_prefix,
|
||||
bool use_full,
|
||||
bool use_location);
|
||||
bool BPy_errors_to_report_brief_with_prefix(struct ReportList *reports, const char *error_prefix);
|
||||
/**
|
||||
* \param reports: When set, an error will be added to this report, when NULL, print the error.
|
||||
*
|
||||
* \note Unless the caller handles printing the reports (or reports is NULL) it's best to ensure
|
||||
* the output is printed to the `stdout/stderr`:
|
||||
* \code{.cc}
|
||||
* BPy_errors_to_report(reports);
|
||||
* if (!BKE_reports_print_test(reports)) {
|
||||
* BKE_reports_print(reports);
|
||||
* }
|
||||
* \endcode
|
||||
*/
|
||||
bool BPy_errors_to_report(struct ReportList *reports);
|
||||
|
||||
struct bContext *BPY_context_get(void);
|
||||
|
||||
Reference in New Issue
Block a user