initialize keymaps after python so python keymaps, solves the problem of keymaps complaining about python operators not existing, but at the expense of some annoying init flags/functions. :/
Brecht/Ton you may want to check that C->data.py_init is a good place to store this.
This commit is contained in:
@@ -101,6 +101,10 @@ bContextStore *CTX_store_copy(bContextStore *store);
|
||||
void CTX_store_free(bContextStore *store);
|
||||
void CTX_store_free_list(ListBase *contexts);
|
||||
|
||||
/* need to store if python is initialized or not */
|
||||
int CTX_py_init_get(bContext *C);
|
||||
int CTX_py_init_set(bContext *C, int value);
|
||||
|
||||
/* Window Manager Context */
|
||||
|
||||
struct wmWindowManager *CTX_wm_manager(const bContext *C);
|
||||
|
||||
@@ -68,6 +68,7 @@ struct bContext {
|
||||
struct Scene *scene;
|
||||
|
||||
int recursion;
|
||||
int py_init; /* true if python is initialized */
|
||||
} data;
|
||||
|
||||
/* data evaluation */
|
||||
@@ -162,6 +163,16 @@ void CTX_store_free_list(ListBase *contexts)
|
||||
}
|
||||
}
|
||||
|
||||
/* is python initialied? */
|
||||
int CTX_py_init_get(bContext *C)
|
||||
{
|
||||
return C->data.py_init;
|
||||
}
|
||||
int CTX_py_init_set(bContext *C, int value)
|
||||
{
|
||||
C->data.py_init= value;
|
||||
}
|
||||
|
||||
/* window manager context */
|
||||
|
||||
wmWindowManager *CTX_wm_manager(const bContext *C)
|
||||
|
||||
@@ -117,6 +117,9 @@ typedef struct wmWindowManager {
|
||||
|
||||
} wmWindowManager;
|
||||
|
||||
/* wmWindowManager.initialized */
|
||||
#define WM_INIT_WINDOW 1<<0
|
||||
#define WM_INIT_KEYMAP 1<<1
|
||||
|
||||
/* the savable part, rest of data is local in ghostwinlay */
|
||||
typedef struct wmWindow {
|
||||
|
||||
@@ -72,6 +72,7 @@ void *WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct b
|
||||
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
|
||||
|
||||
/* keymap */
|
||||
void WM_keymap_init (struct bContext *C);
|
||||
wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type,
|
||||
short val, int modifier, short keymodifier);
|
||||
wmKeymapItem *WM_keymap_add_item(ListBase *lb, char *idname, short type,
|
||||
|
||||
@@ -120,6 +120,18 @@ void WM_operator_stack_clear(bContext *C)
|
||||
|
||||
/* ****************************************** */
|
||||
|
||||
void WM_keymap_init(bContext *C)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
|
||||
if(CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
|
||||
wm_window_keymap(wm);
|
||||
ED_spacetypes_keymap(wm);
|
||||
|
||||
wm->initialized |= WM_INIT_KEYMAP;
|
||||
}
|
||||
}
|
||||
|
||||
void wm_check(bContext *C)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
@@ -136,13 +148,12 @@ void wm_check(bContext *C)
|
||||
wm_window_add_ghostwindows(wm);
|
||||
|
||||
/* case: fileread */
|
||||
if(wm->initialized==0) {
|
||||
if((wm->initialized & WM_INIT_WINDOW) == 0) {
|
||||
|
||||
wm_window_keymap(wm);
|
||||
ED_spacetypes_keymap(wm);
|
||||
WM_keymap_init(C);
|
||||
|
||||
ED_screens_initialize(wm);
|
||||
wm->initialized= 1;
|
||||
wm->initialized |= WM_INIT_WINDOW;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user