[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43875] trunk/blender/source/blender/ windowmanager/intern/wm_event_system.c: fix [#30060] self. report printed twice

Campbell Barton ideasman42 at gmail.com
Sat Feb 4 01:37:02 CET 2012


Revision: 43875
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43875
Author:   campbellbarton
Date:     2012-02-04 00:36:55 +0000 (Sat, 04 Feb 2012)
Log Message:
-----------
fix [#30060] self.report printed twice

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2012-02-03 20:12:21 UTC (rev 43874)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2012-02-04 00:36:55 UTC (rev 43875)
@@ -457,9 +457,10 @@
 
 #endif /* NDEBUG */
 
-static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup)
+/* (caller_owns_reports == TRUE) when called from python */
+static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int caller_owns_reports)
 {
-	if(popup) {
+	if (caller_owns_reports == FALSE) { /* popup */
 		if(op->reports->list.first) {
 			/* FIXME, temp setting window, see other call to uiPupMenuReports for why */
 			wmWindow *win_prev= CTX_wm_window(C);
@@ -478,10 +479,15 @@
 	}
 	
 	if(retval & OPERATOR_FINISHED) {
-		if(G.f & G_DEBUG)
-			wm_operator_print(C, op); /* todo - this print may double up, might want to check more flags then the FINISHED */
-		
-		BKE_reports_print(op->reports, RPT_DEBUG); /* print out reports to console. */
+		if(G.f & G_DEBUG) {
+			/* todo - this print may double up, might want to check more flags then the FINISHED */
+			wm_operator_print(C, op);
+		}
+
+		if (caller_owns_reports == FALSE) {
+			BKE_reports_print(op->reports, RPT_DEBUG); /* print out reports to console. */
+		}
+
 		if (op->type->flag & OPTYPE_REGISTER) {
 			if(G.background == 0) { /* ends up printing these in the terminal, gets annoying */
 				/* Report the python string representation of the operator */
@@ -492,7 +498,7 @@
 		}
 	}
 
-	/* if the caller owns them them handle this */
+	/* if the caller owns them, handle this */
 	if (op->reports->list.first && (op->reports->flag & RPT_OP_HOLD) == 0) {
 
 		wmWindowManager *wm = CTX_wm_manager(C);
@@ -574,7 +580,7 @@
 	}
 	
 	if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED) && repeat == 0)
-		wm_operator_reports(C, op, retval, 0);
+		wm_operator_reports(C, op, retval, FALSE);
 	
 	if(retval & OPERATOR_FINISHED)
 		wm_operator_finished(C, op, repeat);
@@ -817,10 +823,11 @@
 		
 		/* Note, if the report is given as an argument then assume the caller will deal with displaying them
 		 * currently python only uses this */
-		if (!(retval & OPERATOR_HANDLED) && retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED))
+		if (!(retval & OPERATOR_HANDLED) && (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED))) {
 			/* only show the report if the report list was not given in the function */
-			wm_operator_reports(C, op, retval, (reports==NULL));
-		
+			wm_operator_reports(C, op, retval, (reports != NULL));
+		}
+
 		if(retval & OPERATOR_HANDLED)
 			; /* do nothing, wm_operator_exec() has been called somewhere */
 		else if(retval & OPERATOR_FINISHED) {
@@ -829,7 +836,7 @@
 		else if(retval & OPERATOR_RUNNING_MODAL) {
 			/* grab cursor during blocking modal ops (X11)
 			 * Also check for macro
-			 * */
+			 */
 			if(ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
 				int bounds[4] = {-1,-1,-1,-1};
 				int wrap;
@@ -1335,7 +1342,7 @@
 				}
 
 				if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED))
-					wm_operator_reports(C, op, retval, 0);
+					wm_operator_reports(C, op, retval, FALSE);
 
 				if(retval & OPERATOR_FINISHED) {
 					wm_operator_finished(C, op, 0);




More information about the Bf-blender-cvs mailing list