Fix #104838: Modifier keys are not listed in "Is key Free" addon #104839

Merged
Pratik Borhade merged 5 commits from jmztn/blender-addons:jmztn-iskeyfree into main 2023-08-23 11:22:29 +02:00
Showing only changes of commit 8a65396544 - Show all commits

View File

@ -47,13 +47,13 @@ class MyChecker():
def check(cls, findkey, ctrl, alt, shift, oskey): def check(cls, findkey, ctrl, alt, shift, oskey):
if len(findkey) > 0: if len(findkey) > 0:
cmd = "" cmd = ""
if ctrl is True: if ctrl :
cmd += "Ctrl+" cmd += "Ctrl+"
if alt is True: if alt :
cmd += "Alt+" cmd += "Alt+"
if shift is True: if shift :
cmd += "Shift+" cmd += "Shift+"
if oskey is True: if oskey :
cmd += "OsKey+" cmd += "OsKey+"
cls.lastfind = cmd + findkey.upper() cls.lastfind = cmd + findkey.upper()
cls.lastkey = findkey.upper() cls.lastkey = findkey.upper()
@ -66,21 +66,21 @@ class MyChecker():
for context, keyboardmap in wm.keyconfigs.user.keymaps.items(): for context, keyboardmap in wm.keyconfigs.user.keymaps.items():
for myitem in keyboardmap.keymap_items: for myitem in keyboardmap.keymap_items:
if myitem.active is True and myitem.type == findkey: if myitem.active and myitem.type == findkey:
if ctrl is True and myitem.ctrl is not True: if ctrl and not myitem.ctrl:
continue continue
if alt is True and myitem.alt is not True: if alt and not myitem.alt:
continue continue
if shift is True and myitem.shift is not True: if shift and myitem.shift:
continue continue
if oskey is True and myitem.oskey is not True: if oskey and myitem.oskey:
continue continue
t = (context, t = (context,
myitem.type, myitem.type,
"Ctrl" if myitem.ctrl is True else "", "Ctrl" if myitem.ctrl else "",
"Alt" if myitem.alt is True else "", "Alt" if myitem.alt else "",
"Shift" if myitem.shift is True else "", "Shift" if myitem.shift else "",
"OsKey" if myitem.oskey is True else "", "OsKey" if myitem.oskey else "",
myitem.name) myitem.name)
mykeys.append(t) mykeys.append(t)
@ -512,10 +512,10 @@ class IsKeyFreeRunExportKeys(Operator):
col_width = padding + 2 if padding > col_width else col_width col_width = padding + 2 if padding > col_width else col_width
short_type = myitem.type if myitem.type else "UNKNOWN" short_type = myitem.type if myitem.type else "UNKNOWN"
is_ctrl = " Ctrl" if myitem.ctrl is True else "" is_ctrl = " Ctrl" if myitem.ctrl else ""
is_alt = " Alt" if myitem.alt is True else "" is_alt = " Alt" if myitem.alt else ""
is_shift = " Shift" if myitem.shift is True else "" is_shift = " Shift" if myitem.shift else ""
is_oskey = " OsKey" if myitem.oskey is True else "" is_oskey = " OsKey" if myitem.oskey else ""
short_cuts = "{}{}{}{}{}".format(short_type, is_ctrl, is_alt, is_shift, is_oskey) short_cuts = "{}{}{}{}{}".format(short_type, is_ctrl, is_alt, is_shift, is_oskey)
t = ( t = (