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): def check(cls, findkey, ctrl, alt, shift, oskey):
if len(findkey) > 0: if len(findkey) > 0:
cmd = "" cmd = ""
if ctrl is True: if ctrl == 1:
cmd += "Ctrl+" cmd += "Ctrl+"
if alt is True: if alt == 1:
cmd += "Alt+" cmd += "Alt+"
if shift is True: if shift == 1:
cmd += "Shift+" cmd += "Shift+"
if oskey is True: if oskey == 1:
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 == 1 and myitem.type == findkey:
if ctrl is True and myitem.ctrl is not True: if ctrl == 1 and myitem.ctrl == 0:
continue continue
if alt is True and myitem.alt is not True: if alt == 1 and myitem.alt == 0:
continue continue
if shift is True and myitem.shift is not True: if shift == 1 and myitem.shift == 0:
continue continue
if oskey is True and myitem.oskey is not True: if oskey == 1 and myitem.oskey == 0:
continue continue
t = (context, t = (context,
myitem.type, myitem.type,
"Ctrl" if myitem.ctrl is True else "", "Ctrl" if myitem.ctrl == 1 else "",
"Alt" if myitem.alt is True else "", "Alt" if myitem.alt == 1 else "",
"Shift" if myitem.shift is True else "", "Shift" if myitem.shift == 1 else "",
"OsKey" if myitem.oskey is True else "", "OsKey" if myitem.oskey == 1 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 == 1 else ""
is_alt = " Alt" if myitem.alt is True else "" is_alt = " Alt" if myitem.alt == 1 else ""
is_shift = " Shift" if myitem.shift is True else "" is_shift = " Shift" if myitem.shift == 1 else ""
is_oskey = " OsKey" if myitem.oskey is True else "" is_oskey = " OsKey" if myitem.oskey == 1 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 = (