Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created October 4, 2012 18:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/3835647 to your computer and use it in GitHub Desktop.
Save zeffii/3835647 to your computer and use it in GitHub Desktop.
scripted keymapping
# script to map 1, 2, 3 to vertex, edge, face selection for 3dview
import bpy
wm = bpy.context.window_manager
if True:
deactivate_list = ['ONE', 'TWO', 'THREE']
view3d_km_items = wm.keyconfigs.default.keymaps['3D View'].keymap_items
for j in view3d_km_items:
if j.type in deactivate_list and j.name == 'Layers':
j.active = False
if True:
my_keymap = { 'ONE': "True, False, False",
'TWO': "False, True, False",
'THREE': "False, False, True"}
km = wm.keyconfigs.default.keymaps['Mesh']
for k, v in my_keymap.items():
new_shortcut = km.keymap_items.new('wm.context_set_value', k, 'PRESS')
new_shortcut.properties.data_path = 'tool_settings.mesh_select_mode'
new_shortcut.properties.value = v
print('complete')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment