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 | |
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')
-rw-r--r-- | source/blender/windowmanager/WM_keymap.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 24 |
2 files changed, 22 insertions, 5 deletions
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index 43369154dbb..49ee759bbf2 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -64,7 +64,7 @@ wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, in int val, int modifier, int keymodifier); int WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi); -char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len); +int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len); wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid); wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid); @@ -81,6 +81,7 @@ wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, st wmKeyMap *WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname); wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value); wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value); +wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue); void WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname); /* Keymap Editor */ 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( |