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 299ecc67a6 - Show all commits

View File

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