[Bf-blender-cvs] [c6642f06ab2] master: Fix T96395: NDOF entries prevent loading of custom keymaps in 3.2

Campbell Barton noreply at git.blender.org
Mon Mar 14 10:43:05 CET 2022


Commit: c6642f06ab2655e47705e69bc6c0f0f35d964ada
Author: Campbell Barton
Date:   Mon Mar 14 20:41:05 2022 +1100
Branches: master
https://developer.blender.org/rBc6642f06ab2655e47705e69bc6c0f0f35d964ada

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.

===================================================================

M	release/scripts/modules/bl_keymap_utils/versioning.py

===================================================================

diff --git a/release/scripts/modules/bl_keymap_utils/versioning.py b/release/scripts/modules/bl_keymap_utils/versioning.py
index 402c21f8ef1..59ea2e62d3b 100644
--- a/release/scripts/modules/bl_keymap_utils/versioning.py
+++ b/release/scripts/modules/bl_keymap_utils/versioning.py
@@ -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



More information about the Bf-blender-cvs mailing list