diff options
Diffstat (limited to 'source/blender/blenkernel/intern/report.c')
-rw-r--r-- | source/blender/blenkernel/intern/report.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index 98b680c8054..6d654730bca 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -86,9 +86,7 @@ void BKE_report(ReportList *reports, eReportType type, const char *_message) int len; const char *message = TIP_(_message); - /* in background mode always print otherwise there are cases the errors won't be displayed, - * but still add to the report list since this is used for python exception handling */ - if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) { + if (BKE_reports_print_test(reports, type)) { printf("%s: %s\n", BKE_report_type_str(type), message); fflush(stdout); /* this ensures the message is printed before a crash */ } @@ -115,7 +113,7 @@ void BKE_reportf(ReportList *reports, eReportType type, const char *_format, ... va_list args; const char *format = TIP_(_format); - if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) { + if (BKE_reports_print_test(reports, type)) { printf("%s: ", BKE_report_type_str(type)); va_start(args, _format); vprintf(format, args); @@ -258,6 +256,14 @@ char *BKE_reports_string(ReportList *reports, eReportType level) return cstring; } +bool BKE_reports_print_test(const ReportList *reports, eReportType type) +{ + /* In background mode always print otherwise there are cases the errors won't be displayed, + * but still add to the report list since this is used for python exception handling. */ + return (G.background || (reports == NULL) || + ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))); +} + void BKE_reports_print(ReportList *reports, eReportType level) { char *cstring = BKE_reports_string(reports, level); |