Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import bpy
wm = bpy.context.window_manager
CopiedMap = wm.keyconfigs.new("CopiedMap")
#Get list of default keymap items
keymaps = wm.keyconfigs.default.keymaps.items()
for i in keymaps:
#Put default values in to new keymaps
CopiedMap.keymaps.new(i[1].name, space_type= i[1].space_type,
region_type=i[1].region_type)
#Get list of default keymap_items contained
#within the keymap
keymap_items = i[1].keymap_items.items()
for j in keymap_items:
#Put values in to new keymap_items
CopiedMap.keymaps[i[1].name].keymap_items.new(j[1].idname, j[1].type, j[1].value, any=j[1].any,
shift=j[1].shift, ctrl=j[1].ctrl, alt=j[1].alt,
oskey=j[1].oskey, key_modifier=j[1].key_modifier)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment