static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) { ReportList *reports = CTX_wm_reports(C); Text *txt; char *str; /* create new text-block to write to */ txt = add_empty_text("Recent Reports"); /* convert entire list to a display string, and add this to the text-block * - if commandline debug option enabled, show debug reports too * - otherwise, up to info (which is what users normally see) */ str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO); if (str) { write_text(txt, str); MEM_freeN(str); return OPERATOR_FINISHED; } else { return OPERATOR_CANCELLED; } }
Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name) { return add_empty_text(name); }