Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-11-22 03:13:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-22 03:13:53 +0300
commit3b7daa5bf46598267844a3fcf60109b69c5dae1f (patch)
tree544a3b27617e9aa78470d98f518bb9e292f4a641 /release/scripts
parent1a4595618c959da17ddec9cef839f8bf654f4727 (diff)
Tool System: Updates for keymap stored as string
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py26
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_common.py10
2 files changed, 24 insertions, 12 deletions
diff --git a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
index b5dcb123120..183f13b92fb 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
@@ -197,17 +197,23 @@ def generate(context, space_type):
context='INVOKE_REGION_WIN',
)[1]
elif item.keymap is not None:
- kmi_first = item.keymap[0].keymap_items
- kmi_first = kmi_first[0] if kmi_first else None
- if kmi_first is not None:
- kmi_found = wm.keyconfigs.find_item_from_operator(
- idname=kmi_first.idname,
- # properties=kmi_first.properties, # prevents matches, don't use.
- context='INVOKE_REGION_WIN',
- )[1]
- else:
+ km = keyconf.keymaps.get(item.keymap[0])
+ if km is None:
+ print("Keymap", repr(item.keymap[0]), "not found for tool", item.text)
kmi_found = None
- del kmi_first
+ else:
+ kmi_first = km.keymap_items
+ kmi_first = kmi_first[0] if kmi_first else None
+ if kmi_first is not None:
+ kmi_found = wm.keyconfigs.find_item_from_operator(
+ idname=kmi_first.idname,
+ # properties=kmi_first.properties, # prevents matches, don't use.
+ context='INVOKE_REGION_WIN',
+ )[1]
+ else:
+ kmi_found = None
+ del kmi_first
+ del km
else:
kmi_found = None
item_container[1] = kmi_found
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 09a1d961e24..2ff5c9692ec 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -687,8 +687,14 @@ def description_from_name(context, space_type, text, *, use_operator=True):
if operator is None:
if item.keymap is not None:
- if item.keymap[0].keymap_items:
- operator = item.keymap[0].keymap_items[0].idname
+ wm = context.window_manager
+ keyconf = wm.keyconfigs.active
+ km = keyconf.keymaps.get(item.keymap[0])
+ if km is not None:
+ for kmi in km.keymap_items:
+ if kmi.active:
+ operator = kmi.idname
+ break
if operator is not None:
import _bpy