[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18558] branches/blender2.5/blender/source /blender: Made modal operators print their operator string after executing

Campbell Barton ideasman42 at gmail.com
Sun Jan 18 08:35:58 CET 2009


Revision: 18558
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18558
Author:   campbellbarton
Date:     2009-01-18 08:35:44 +0100 (Sun, 18 Jan 2009)

Log Message:
-----------
Made modal operators print their operator string after executing
(when in debug "-d" mode only)

copy & paste duplicate and transform operations can now be copied from user input and pasted into ./test.py and run with the Pkey (fixed some minor bugs preventing this)

Would be nice if the "mode" setting used a proper RNA Enum rather then an int. 

# example, duplicate and transform
bpyoperator.OBJECT_OT_add_duplicate(mode=1)
bpyoperator.TFM_OT_transform(mode=1, options=0, values=(-1.23989, 0.570745, 0, 0), constraint_orientation=0, constraint_mode=0, constraint_matrix=(0, 0, 0, 0, 0, 0, 0, 0, 0))

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c	2009-01-18 01:26:20 UTC (rev 18557)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c	2009-01-18 07:35:44 UTC (rev 18558)
@@ -1939,7 +1939,7 @@
 		else {
 			BLI_dynstr_append(dynstr, "(");
 			for(i=0; i<len; i++) {
-				BLI_dynstr_appendf(dynstr, i?"%s, ":"%s", RNA_property_boolean_get_array(ptr, prop, i) ? "True" : "False");
+				BLI_dynstr_appendf(dynstr, i?", %s":"%s", RNA_property_boolean_get_array(ptr, prop, i) ? "True" : "False");
 			}
 			BLI_dynstr_append(dynstr, ")");
 		}
@@ -1951,19 +1951,19 @@
 		else {
 			BLI_dynstr_append(dynstr, "(");
 			for(i=0; i<len; i++) {
-				BLI_dynstr_appendf(dynstr, i?"%d, ":"%d", RNA_property_int_get_array(ptr, prop, i));
+				BLI_dynstr_appendf(dynstr, i?", %d":"%d", RNA_property_int_get_array(ptr, prop, i));
 			}
 			BLI_dynstr_append(dynstr, ")");
 		}
 		break;
 	case PROP_FLOAT:
 		if (len==0) {
-			BLI_dynstr_appendf(dynstr, "%f", RNA_property_float_get(ptr, prop));
+			BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
 		}
 		else {
 			BLI_dynstr_append(dynstr, "(");
 			for(i=0; i<len; i++) {
-				BLI_dynstr_appendf(dynstr, i?"%f, ":"%f", RNA_property_float_get_array(ptr, prop, i));
+				BLI_dynstr_appendf(dynstr, i?", %g":"%g", RNA_property_float_get_array(ptr, prop, i));
 			}
 			BLI_dynstr_append(dynstr, ")");
 		}

Modified: branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c	2009-01-18 01:26:20 UTC (rev 18557)
+++ branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c	2009-01-18 07:35:44 UTC (rev 18558)
@@ -448,7 +448,7 @@
 	if(ot->poll==NULL || ot->poll(C)) {
 		wmOperator *op= MEM_callocN(sizeof(wmOperator), ot->idname);	/* XXX operatortype names are static still. for debug */
 
-		if((G.f & G_DEBUG) && event->type!=MOUSEMOVE)
+		if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
 			printf("handle evt %d win %d op %s\n", event?event->type:0, CTX_wm_screen(C)->subwinactive, ot->idname); 
 		
 		/* XXX adding new operator could be function, only happens here now */
@@ -482,12 +482,14 @@
 		else
 			printf("invalid operator call %s\n", ot->idname); /* debug, important to leave a while, should never happen */
 
-		if(G.f & G_DEBUG)
-			WM_operator_print(op);
-
-		if(!(retval & OPERATOR_RUNNING_MODAL))
+		if(!(retval & OPERATOR_RUNNING_MODAL)) {
 			if(reports==NULL && op->reports->list.first) /* only show the report if the report list was not given in the function */
 				uiPupmenuReports(C, op->reports);
+		
+		if (retval & OPERATOR_FINISHED) /* todo - this may conflict with the other WM_operator_print, if theres ever 2 prints for 1 action will may need to add modal check here */
+			if(G.f & G_DEBUG)
+				WM_operator_print(op);
+		}
 
 		if((retval & OPERATOR_FINISHED) && (ot->flag & OPTYPE_REGISTER)) {
 			wm_operator_register(wm, op);
@@ -738,7 +740,12 @@
 			if(!(retval & OPERATOR_RUNNING_MODAL))
 				if(op->reports->list.first)
 					uiPupmenuReports(C, op->reports);
-			
+
+			if (retval & OPERATOR_FINISHED) {
+				if(G.f & G_DEBUG)
+					WM_operator_print(op); /* todo - this print may double up, might want to check more flags then the FINISHED */
+			}			
+
 			if((retval & OPERATOR_FINISHED) && (ot->flag & OPTYPE_REGISTER)) {
 				wm_operator_register(CTX_wm_manager(C), op);
 				handler->op= NULL;





More information about the Bf-blender-cvs mailing list