Fix T96395: NDOF entries prevent loading of custom keymaps in 3.2

Even though the default key-map didn't use NDOF types some key-maps did.
This commit is contained in:
Campbell Barton 2022-03-14 20:41:05 +11:00
parent 82e7956f12
commit c6642f06ab
Notes: blender-bot 2023-02-14 18:23:42 +01:00
Referenced by issue blender/blender-addons#96395, NDOF related entries prevent loading of custom keymaps in 3.2
1 changed files with 16 additions and 2 deletions

View File

@ -14,11 +14,11 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
# Version the key-map.
import copy
# Only copy once.
has_copy = False
# Default repeat to false.
if keyconfig_version <= (2, 92, 0):
# Only copy once.
if not has_copy:
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
@ -31,7 +31,6 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
item_event["repeat"] = True
if keyconfig_version <= (3, 2, 5):
# Only copy once.
if not has_copy:
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
@ -48,4 +47,19 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
item_event["direction"] = value
item_event["value"] = 'CLICK_DRAG'
if keyconfig_version <= (3, 2, 6):
if not has_copy:
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
for _km_name, _km_parms, km_items_data in keyconfig_data:
for (_item_op, item_event, _item_prop) in km_items_data["items"]:
if ty_new := {
'NDOF_BUTTON_ESC': 'ESC',
'NDOF_BUTTON_ALT': 'LEFT_ALT',
'NDOF_BUTTON_SHIFT': 'LEFT_SHIFT',
'NDOF_BUTTON_CTRL': 'LEFT_CTRL',
}.get(item_event.get("type")):
item_event["type"] = ty_new
return keyconfig_data