diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-12-06 05:42:59 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-12-06 05:42:59 +0300 |
commit | a1fed1e268aa3bd6ad32acf751022e5f12db0233 (patch) | |
tree | 0fd6fe1efdd219d2ceef62bf906996435fe41f1d /release | |
parent | a724918cf3997cbd1fc33c663d1a76441c2deeb0 (diff) |
[#25047] Deletion of any custom key map item remove always first one
keymap item id for user defined keymaps wasn't defined properly. This is really old, I'm surprised with didn't catch this before.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/ui/space_userpref_keymap.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py index 70fb2c57e9b..4569020efd9 100644 --- a/release/scripts/ui/space_userpref_keymap.py +++ b/release/scripts/ui/space_userpref_keymap.py @@ -279,7 +279,7 @@ class InputKeyMapPanel(bpy.types.Panel): else: row.label() - if kmi.id: + if not kmi.is_user_defined: op = row.operator("wm.keyitem_restore", text="", icon='BACK') op.item_id = kmi.id op = row.operator("wm.keyitem_remove", text="", icon='X') @@ -708,12 +708,18 @@ class WM_OT_keyitem_restore(bpy.types.Operator): item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove") + @classmethod + def poll(cls, context): + km = context.keymap + return km.is_user_defined + def execute(self, context): wm = context.window_manager km = context.keymap kmi = km.items.from_id(self.item_id) - km.restore_item_to_default(kmi) + if not kmi.is_user_defined: + km.restore_item_to_default(kmi) return {'FINISHED'} @@ -749,8 +755,12 @@ class WM_OT_keyitem_remove(bpy.types.Operator): item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove") + @classmethod + def poll(cls, context): + km = context.keymap + return km.is_user_defined + def execute(self, context): - wm = context.window_manager km = context.keymap kmi = km.items.from_id(self.item_id) km.items.remove(kmi) |