diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_report.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/report.c | 28 |
2 files changed, 25 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h index 8a5c623a225..21221026b8b 100644 --- a/source/blender/blenkernel/BKE_report.h +++ b/source/blender/blenkernel/BKE_report.h @@ -80,6 +80,7 @@ void BKE_report_print_level_set(ReportList *reports, ReportType level); ReportType BKE_report_store_level(ReportList *reports); void BKE_report_store_level_set(ReportList *reports, ReportType level); +char *BKE_reports_string(ReportList *reports, ReportType level); void BKE_reports_print(ReportList *reports, ReportType level); #ifdef __cplusplus diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index 97bbaf66b3a..5ba21529c5c 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -215,17 +215,37 @@ void BKE_report_store_level_set(ReportList *reports, ReportType level) reports->storelevel= level; } -void BKE_reports_print(ReportList *reports, ReportType level) +char *BKE_reports_string(ReportList *reports, ReportType level) { Report *report; + DynStr *ds; + char *cstring; if(!reports) - return; - + return NULL; + + ds= BLI_dynstr_new(); for(report=reports->list.first; report; report=report->next) if(report->type >= level) - printf("%s: %s\n", report->typestr, report->message); + BLI_dynstr_appendf(ds, "%s: %s\n", report->typestr, report->message); + + if (BLI_dynstr_get_len(ds)) + cstring= BLI_dynstr_get_cstring(ds); + else + cstring= NULL; + BLI_dynstr_free(ds); + return cstring; +} + +void BKE_reports_print(ReportList *reports, ReportType level) +{ + char *cstring = BKE_reports_string(reports, level); + + if (cstring == NULL) + return; + + printf(cstring); fflush(stdout); } |