Blender Git Commit Log

Git Commits -> Revision 7e2ec90

Revision 7e2ec90 by Joshua Leung (master)
August 30, 2012, 14:08 (GMT)
Bugfix [#32437] Cannot define Alt-E keybinding in Text Editor window

WM_keymap_add_item(keymap, "TEXT_OT_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0);
<--- this catch-all key map item at the end of the Text Editor keymap was
gobbling all the key events for user-defined hotkeys added after it in the
keymap. This includes all hotkeys for new operators defined by addons (via
keymap.keymap_items.new()).

As a slightly hacky workaround for this, I've added an extra parameter to
keymap_items.new() which will force the newly added item to get added to the
start of the key map items list (i.e. with top priority). To enable, simply add,
head=True to keymap_items.new() calls. For example:
keymap.keymap_items.new("MY_OP_my_operator_id", type='E', value='PRESS',
alt=True, head=True)

This should be useful for cases where there are similar catch-alls, where it is
necessary to insert our item before the offending catch-all (without knowing
which one it is). However, in general, it's recommended not to use this, unless
all other methods (inlcuding choosing another key combination if your first
choice doesn't work) fails.

Commit Details:

Full Hash: 7e2ec90db9b9e085434d12211800183d6a612d7f
SVN Revision: 50276
Parent Commit: 0db80bd
Lines Changed: +18, -3

1 Modified Path:

/source/blender/makesrna/intern/rna_wm_api.c (+18, -3) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021