diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-01-02 10:54:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-01-02 10:54:38 +0300 |
commit | 5d23eaa8f462cdace80b8afc2b766068b4630243 (patch) | |
tree | a24348957a690523f007be7c36035de628f2b743 /source/blender/blenkernel/intern | |
parent | cf43c6b0a1a125cf49207d382b6ae6157e0905b4 (diff) |
python support for reporting with operators.
* errors in python called operators are raised as errors
* Python defined operators errors are reported as errors (not full traceback yet)
* added BKE_reports_string, same as BKE_reports_print but it returns a string rather then printing it.
* WM_operator_name_call optionally takes an initialized report struct
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/report.c | 28 |
1 files changed, 24 insertions, 4 deletions
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); } |