diff options
author | Matt Ebb <matt@mke3.net> | 2010-01-26 04:02:10 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-01-26 04:02:10 +0300 |
commit | ba2257b57e56cc410288756de491969f4e207985 (patch) | |
tree | 4d058bcfad7168527b6f976d7d86bdb0a29d48ea /source/blender/editors/interface | |
parent | aba738aa34bf8078e0b6e698166576faf1462d5d (diff) |
Fix [#20798] - Add/change/remove shortcut options dissapearing from buttons @ Tool Shelf
Made the RMB menus for manipulating shortcuts a bit more robust (only dealing with mouse
clicks/key events, rather than all tweaks/timers/etc) and added ability to add key shortcuts for
transform tools from the RMB menu.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index dcb2f1810ce..b4da74b4664 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3456,7 +3456,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) uiLayout *layout; uiStyle *style= U.uistyles.first; IDProperty *prop= (but->opptr)? but->opptr->data: NULL; - int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, &km); + int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); kmi = WM_keymap_item_find_id(km, kmi_id); @@ -3524,7 +3524,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) wmKeyMap *km; wmKeyMapItem *kmi; IDProperty *prop= (but->opptr)? but->opptr->data: NULL; - int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, &km); + int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); kmi = WM_keymap_item_find_id(km, kmi_id); WM_keymap_remove_item(km, kmi); @@ -3662,10 +3662,12 @@ static int ui_but_menu(bContext *C, uiBut *but) uiBut *but2; IDProperty *prop= (but->opptr)? but->opptr->data: NULL; int w = uiLayoutGetWidth(layout); - char buf[512]; + wmKeyMap *km; + int kmi_id= WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); + wmKeyMapItem *kmi = WM_keymap_item_find_id(km, kmi_id); /* keyboard shortcuts */ - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { + if ((kmi) && ISKEYBOARD(kmi->type)) { // would rather use a block but, but gets weirdly positioned... //uiDefBlockBut(block, menu_change_shortcut, but, "Change Shortcut", 0, 0, uiLayoutGetWidth(layout), UI_UNIT_Y, ""); |