diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-15 16:10:29 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-15 16:10:29 +0300 |
commit | d48f4b6012ccfc1a1da6a1a002d7c86cacbd98aa (patch) | |
tree | 17042a225366b4d6fc85e0b91534d9d1d952cf9d /source/blender/editors | |
parent | b4aef1673369b8f0a4e8009f9aab38c7c586ef4f (diff) |
2.5: added support for setting RNA properties in keymap item,
which will then be set when the operator is called, example:
kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "dir", 'h');
kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "dir", 'v');
There is a hack I had to do here, since properties are defined
as member of wmOperator, will try to fix later, committing now
so it can be used already.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a818c47bbbd..1f7563b4824 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1226,13 +1226,6 @@ static int region_split_exec(bContext *C, wmOperator *op) static int region_split_invoke(bContext *C, wmOperator *op, wmEvent *evt) { - - /* can't do menu, so event is checked manually */ - if(evt->shift) - RNA_enum_set(op->ptr, "dir", 'v'); - else - RNA_enum_set(op->ptr, "dir", 'h'); - return region_split_exec(C, op); } @@ -1374,6 +1367,7 @@ void ED_operatortypes_screen(void) void ED_keymap_screen(wmWindowManager *wm) { ListBase *keymap= WM_keymap_listbase(wm, "Screen", 0, 0); + wmKeymapItem *kmi; WM_keymap_verify_item(keymap, "ED_SCR_OT_cursor_type", MOUSEMOVE, 0, 0, 0); WM_keymap_verify_item(keymap, "ED_SCR_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0); @@ -1384,8 +1378,10 @@ void ED_keymap_screen(wmWindowManager *wm) WM_keymap_verify_item(keymap, "ED_SCR_OT_area_rip", RKEY, KM_PRESS, KM_ALT, 0); /* tests */ - WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0); + kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "dir", 'h'); + kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0); + RNA_enum_set(kmi->ptr, "dir", 'v'); WM_keymap_add_item(keymap, "ED_SCR_OT_region_flip", F5KEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "ED_SCR_OT_repeat_last", F4KEY, KM_PRESS, 0, 0); } |