diff options
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 13 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 21 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/wm.h | 2 |
6 files changed, 43 insertions, 6 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index ab55f8a4459..3a646c5e799 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -131,6 +131,7 @@ typedef struct wmNotifier { #define NC_WORLD (13<<24) #define NC_FILE (14<<24) #define NC_ANIMATION (15<<24) +#define NC_CONSOLE (16<<24) /* data type, 256 entries is enough, it can overlap */ #define NOTE_DATA 0x00FF0000 @@ -200,6 +201,10 @@ typedef struct wmNotifier { #define ND_NLA_EDIT (76<<16) #define ND_NLA_ACTCHANGE (77<<16) + /* console */ +#define ND_CONSOLE (78<<16) /* general redraw */ +#define ND_CONSOLE_REPORT (79<<16) /* update for reports, could spesify type */ + /* subtype, 256 entries too */ #define NOTE_SUBTYPE 0x0000FF00 diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 7dec14664ae..6b3b128d34b 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -79,9 +79,11 @@ void WM_operator_free(wmOperator *op) /* all operations get registered in the windowmanager here */ /* called on event handling by event_system.c */ -void wm_operator_register(wmWindowManager *wm, wmOperator *op) +void wm_operator_register(bContext *C, wmOperator *op) { + wmWindowManager *wm= CTX_wm_manager(C); int tot; + char *buf; BLI_addtail(&wm->operators, op); tot= BLI_countlist(&wm->operators); @@ -92,6 +94,15 @@ void wm_operator_register(wmWindowManager *wm, wmOperator *op) WM_operator_free(opt); tot--; } + + + /* Report the string representation of the operator */ + buf = WM_operator_pystring(op); + BKE_report(wm->reports, RPT_OPERATOR, buf); + MEM_freeN(buf); + + /* so the console is redrawn */ + WM_event_add_notifier(C, NC_CONSOLE|ND_CONSOLE_REPORT, NULL); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3ef6e545dda..ffd1054d954 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -268,7 +268,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat) if(repeat==0) { if(op->type->flag & OPTYPE_REGISTER) - wm_operator_register(CTX_wm_manager(C), op); + wm_operator_register(C, op); else WM_operator_free(op); } @@ -374,7 +374,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P ED_undo_push_op(C, op); if(ot->flag & OPTYPE_REGISTER) - wm_operator_register(wm, op); + wm_operator_register(C, op); else WM_operator_free(op); } @@ -697,7 +697,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand ED_undo_push_op(C, op); if(ot->flag & OPTYPE_REGISTER) - wm_operator_register(CTX_wm_manager(C), op); + wm_operator_register(C, op); else WM_operator_free(op); handler->op= NULL; diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 0bc35ffa9b2..5938677afe7 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -51,6 +51,7 @@ #include "BKE_global.h" #include "BKE_library.h" #include "BKE_mball.h" +#include "BKE_report.h" #include "BKE_utildefines.h" #include "BKE_packedFile.h" @@ -100,6 +101,22 @@ static void sound_init_listener(void) G.listener->dopplervelocity = 340.29f; } + +static void wm_init_reports(bContext *C) +{ + wmWindowManager *wm= CTX_wm_manager(C); + wm->reports= MEM_callocN(sizeof(ReportList), "wmReportList"); + BKE_reports_init(wm->reports, RPT_STORE); +} +static void wm_free_reports(bContext *C) +{ + wmWindowManager *wm= CTX_wm_manager(C); + BKE_reports_clear(wm->reports); + MEM_freeN(wm->reports); +} + + + /* only called once, for startup */ void WM_init(bContext *C) { @@ -124,6 +141,8 @@ void WM_init(bContext *C) /* get the default database, plus a wm */ WM_read_homefile(C, NULL); + wm_init_reports(C); /* reports cant be initialized before the wm */ + UI_init(); // clear_matcopybuf(); /* XXX */ @@ -256,6 +275,8 @@ void WM_exit(bContext *C) RNA_exit(); + wm_free_reports(C); + CTX_free(C); if(MEM_get_memory_blocks_in_use()!=0) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index d7cac82ef90..4dbe26bb79f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -165,7 +165,7 @@ char *WM_operator_pystring(wmOperator *op) char *cstring, *buf; int first_iter=1; - BLI_dynstr_appendf(dynstr, "%s(", op->idname); + BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", op->idname); iterprop= RNA_struct_iterator_property(op->ptr->type); diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index e91cbe6b204..36219cf3743 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -47,7 +47,7 @@ extern void wm_check(bContext *C); extern void wm_clear_default_size(bContext *C); /* register to windowmanager for redo or macro */ -void wm_operator_register(wmWindowManager *wm, wmOperator *op); +void wm_operator_register(bContext *C, wmOperator *op); extern void wm_report_free(wmReport *report); |