Fix T63653: Industry Compatible Keymap can't be saved & loaded

Replace keymap specific operator.
This commit is contained in:
Campbell Barton 2019-09-06 04:24:14 +10:00
parent 493fa59225
commit 23d19c2b0d
Notes: blender-bot 2023-02-14 05:36:11 +01:00
Referenced by issue #63653, [Industry Compatible Keymap] Selectionmode operator dosen't work on a custom keymap
2 changed files with 6 additions and 44 deletions

View File

@ -1,40 +1,6 @@
import os
import bpy
# ------------------------------------------------------------------------------
# Operators needed by this keymap to function
# Selection Modes
class IC_KEYMAP_OT_mesh_select_mode(bpy.types.Operator):
bl_idname = "ic_keymap.mesh_select_mode"
bl_label = "Switch to Vertex, Edge or Face Mode from any mode"
bl_options = {'UNDO'}
type: bpy.props.EnumProperty(
name="Mode",
items=(
('VERT', "Vertex", "Switcth to Vertex Mode From any Mode"),
('EDGE', "Edge", "Switcth to Edge Mode From any Mode"),
('FACE', "Face", "Switcth to Face Mode From any Mode"),
),
)
@classmethod
def poll(cls, context):
return (context.active_object is not None) and (context.object.type == 'MESH')
def execute(self, context):
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_mode(type=self.type)
return{'FINISHED'}
classes = (
IC_KEYMAP_OT_mesh_select_mode,
)
# ------------------------------------------------------------------------------
# Keymap
@ -66,8 +32,4 @@ def load():
keyconfig_init_from_data(kc, keyconfig_data)
if __name__ == "__main__":
# XXX, no way to unregister
for cls in classes:
bpy.utils.register_class(cls)
load()

View File

@ -3385,12 +3385,12 @@ def km_object_non_modal(params):
items.extend([
("ic_keymap.mesh_select_mode",{"type": 'ONE', "value": 'PRESS'},
{"properties": [("type", 'VERT')]}),
("ic_keymap.mesh_select_mode",{"type": 'TWO', "value": 'PRESS'},
{"properties": [("type", 'EDGE')]}),
("ic_keymap.mesh_select_mode",{"type": 'THREE', "value": 'PRESS'},
{"properties": [("type", 'FACE')]}),
("object.mode_set_with_submode",{"type": 'ONE', "value": 'PRESS'},
{"properties": [("mode", 'EDIT'), ("mesh_select_mode", {'VERT'})]}),
("object.mode_set_with_submode",{"type": 'TWO', "value": 'PRESS'},
{"properties": [("mode", 'EDIT'), ("mesh_select_mode", {'EDGE'})]}),
("object.mode_set_with_submode",{"type": 'THREE', "value": 'PRESS'},
{"properties": [("mode", 'EDIT'), ("mesh_select_mode", {'FACE'})]}),
("object.mode_set",{"type": 'ONE', "value": 'PRESS'},
{"properties": [("mode", 'EDIT')]}),
("object.mode_set",{"type": 'FOUR', "value": 'PRESS'},