operators called from python were not getting their reports back into python errors.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 Mar 2011 02:38:39 +0000 (02:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 Mar 2011 02:38:39 +0000 (02:38 +0000)
eg:
- console calls operator
- operator calls report
- report went into header rather them back into the console as an error.

source/blender/makesdna/DNA_windowmanager_types.h
source/blender/python/intern/bpy_operator.c
source/blender/windowmanager/intern/wm_event_system.c

index 958c9cffc841046eca0fb299cd60ee8543602200..3072c2c343006d9b9aa8b5594b86209368869c9f 100644 (file)
@@ -85,7 +85,8 @@ typedef enum ReportType {
 enum ReportListFlags {
        RPT_PRINT = 1,
        RPT_STORE = 2,
-       RPT_FREE = 4
+       RPT_FREE = 4,
+       RPT_OP_HOLD = 8 /* dont move them into the operator global list (caller will use) */
 };
 #
 #
index a116aa0e9c01fc270338b7310610c5d6eca1af67..ebe6e05ee4369f292a004ae423b08e82617305cb 100644 (file)
@@ -195,7 +195,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
                        ReportList *reports;
 
                        reports= MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
-                       BKE_reports_init(reports, RPT_STORE);
+                       BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these dont move into global reports */
 
                        operator_ret= WM_operator_call_py(C, ot, context, &ptr, reports);
 
index 20f9a4b7a517cee77f1d34d6a69d55804925a2a8..15964b8c1e56bc51022f71a7acbb48d47f6f604f 100644 (file)
@@ -453,7 +453,8 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop
                }
        }
 
-       if (op->reports->list.first) {
+       /* if the caller owns them them handle this */
+       if (op->reports->list.first && (op->reports->flag & RPT_OP_HOLD) == 0) {
 
                wmWindowManager *wm = CTX_wm_manager(C);
                ReportList *wm_reports= CTX_wm_reports(C);