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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-01-18 10:35:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-01-18 10:35:44 +0300
commit711d04a4995f16abbbaca0deecadd48fefbbe165 (patch)
treed01e88a89ba100b8a246f666e1ee01e19c48d014 /source
parentabfc78afaf7bf5a482f3a821df3ae96ad7c26123 (diff)
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))
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_access.c8
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c19
2 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 979e4d3d7b4..e066516a8eb 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1939,7 +1939,7 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
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 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
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, ")");
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index cca8bce9432..a9069abe113 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -448,7 +448,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
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 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
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 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
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;