Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/intern/bpy_interface_run.c')
-rw-r--r--source/blender/python/intern/bpy_interface_run.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_interface_run.c b/source/blender/python/intern/bpy_interface_run.c
index 147c6cf8187..50a2722c276 100644
--- a/source/blender/python/intern/bpy_interface_run.c
+++ b/source/blender/python/intern/bpy_interface_run.c
@@ -271,7 +271,23 @@ static bool bpy_run_string_impl(bContext *C,
if (retval == NULL) {
ok = false;
- BPy_errors_to_report(CTX_wm_reports(C));
+
+ ReportList reports;
+ BKE_reports_init(&reports, RPT_STORE);
+ BPy_errors_to_report(&reports);
+
+ /* Ensure the reports are printed. */
+ if (!BKE_reports_print_test(&reports, RPT_ERROR)) {
+ BKE_reports_print(&reports, RPT_ERROR);
+ }
+
+ ReportList *wm_reports = CTX_wm_reports(C);
+ if (wm_reports) {
+ BLI_movelisttolist(&wm_reports->list, &reports.list);
+ }
+ else {
+ BKE_reports_clear(&reports);
+ }
}
else {
Py_DECREF(retval);
@@ -330,6 +346,14 @@ static void run_string_handle_error(struct BPy_RunErrInfo *err_info)
}
}
+ /* Print the reports if they were not printed already. */
+ if ((err_info->reports == NULL) || !BKE_reports_print_test(err_info->reports, RPT_ERROR)) {
+ if (err_info->report_prefix) {
+ fprintf(stderr, "%s: ", err_info->report_prefix);
+ }
+ fprintf(stderr, "%s\n", err_str);
+ }
+
if (err_info->r_string != NULL) {
*err_info->r_string = BLI_strdup(err_str);
}