Skip to content

Instantly share code, notes, and snippets.

@tin2tin
Created January 31, 2021 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tin2tin/bbc742d69689ae82df6af3f2455b1ca1 to your computer and use it in GitHub Desktop.
Save tin2tin/bbc742d69689ae82df6af3f2455b1ca1 to your computer and use it in GitHub Desktop.
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