Cleanup: tweak last commit

This commit is contained in:
Campbell Barton 2019-01-07 11:16:11 +11:00
parent 430cf7e15e
commit 96f762500e
Notes: blender-bot 2023-02-14 04:10:13 +01:00
Referenced by issue #60297, Eevee Movie Texture
Referenced by issue #60288, Blender keymapping not working
Referenced by issue #60290, missing UI elements.
Referenced by issue #60282, 2.8 Can't Export to OBJ with Smoothing Groups
Referenced by issue #60254, Rendered view (Cycles) in edit mode shows bugged materials
1 changed files with 10 additions and 6 deletions

View File

@ -230,19 +230,23 @@ def generate(context, space_type):
kmi_first = km.keymap_items
kmi_first = kmi_first[0] if kmi_first else None
if kmi_first is not None:
# We need 'MOUSE' so keys with 'key_modifier' are found.
for kmi_type in ('KEYBOARD', 'MOUSE'):
kmi_found = wm.keyconfigs.find_item_from_operator(
idname=kmi_first.idname,
# properties=kmi_first.properties, # prevents matches, don't use.
context='INVOKE_REGION_WIN',
include={'KEYBOARD'},
)[1]
if kmi_found is None:
# We need non-keyboard events so keys with 'key_modifier' key is found.
kmi_found = wm.keyconfigs.find_item_from_operator(
idname=kmi_first.idname,
# properties=kmi_first.properties, # prevents matches, don't use.
context='INVOKE_REGION_WIN',
include={kmi_type},
exclude={'KEYBOARD'},
)[1]
if kmi_found is not None:
if (kmi_type == 'MOUSE') and (kmi_found.key_modifier == 'NONE'):
if kmi_found.key_modifier == 'NONE':
kmi_found = None
if kmi_found is not None:
break
else:
kmi_found = None
del kmi_first