diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 18:01:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 18:01:02 +0400 |
commit | 9449866bdca7736155b1d8a42bfb230ec3084d51 (patch) | |
tree | 4287cbbe7bee19d0d01bd6bdf52313a484449e0c /source/blender/windowmanager/intern/wm_keymap.c | |
parent | ceb3624b115848d96f11f1507474ee5a61f9e0d0 (diff) |
fix (for one case of...) [#33949] T_ALT_TRANSFORM conflicts with "emulate 3 button mouse"
ShrinkFatten operator now uses scale key to toggle 'Even thickness' option.
With the default keymap this is Alt+S,S.
Added functionality so the header print can get the key used for the modal keymap, some other operators should make use of this too.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_keymap.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index a296c742e5c..92a310ac34e 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -737,6 +737,24 @@ wmKeyMapItem *WM_modalkeymap_add_item_str(wmKeyMap *km, int type, int val, int m return kmi; } +wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue) +{ + + if (km->flag & KEYMAP_MODAL) { + wmKeyMapItem *kmi; + for (kmi = km->items.first; kmi; kmi = kmi->next) { + if (kmi->propvalue == propvalue) { + return kmi; + } + } + } + else { + BLI_assert(!"called with non modal keymap"); + } + + return NULL; +} + void WM_modalkeymap_assign(wmKeyMap *km, const char *opname) { wmOperatorType *ot = WM_operatortype_find(opname, 0); @@ -785,7 +803,7 @@ const char *WM_key_event_string(short type) return ""; } -char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) +int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) { char buf[128]; @@ -818,9 +836,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) } strcat(buf, WM_key_event_string(kmi->type)); - BLI_strncpy(str, buf, len); - - return str; + return BLI_snprintf(str, len, "%s", buf); } static wmKeyMapItem *wm_keymap_item_find_handlers( |