[Bf-blender-cvs] [96f762500ef] master: Cleanup: tweak last commit

Campbell Barton noreply at git.blender.org
Mon Jan 7 01:16:46 CET 2019


Commit: 96f762500ef99ec495b77599449ed258bf691763
Author: Campbell Barton
Date:   Mon Jan 7 11:16:11 2019 +1100
Branches: master
https://developer.blender.org/rB96f762500ef99ec495b77599449ed258bf691763

Cleanup: tweak last commit

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

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

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

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 c49056117bf..a1a65a44750 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
@@ -230,19 +230,23 @@ def generate(context, space_type):
                 kmi_first = km.keymap_items
                 kmi_first = kmi_first[0] if kmi_first else None
                 if kmi_first is not None:
-                    # We need 'MOUSE' so keys with 'key_modifier' are found.
-                    for kmi_type in ('KEYBOARD', 'MOUSE'):
+                    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',
+                        include={'KEYBOARD'},
+                    )[1]
+                    if kmi_found is None:
+                        # We need non-keyboard events so keys with 'key_modifier' key is found.
                         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',
-                            include={kmi_type},
+                            exclude={'KEYBOARD'},
                         )[1]
                         if kmi_found is not None:
-                            if (kmi_type == 'MOUSE') and (kmi_found.key_modifier == 'NONE'):
+                            if kmi_found.key_modifier == 'NONE':
                                 kmi_found = None
-                        if kmi_found is not None:
-                            break
                 else:
                     kmi_found = None
                 del kmi_first



More information about the Bf-blender-cvs mailing list