diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-14 11:15:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-14 11:15:46 +0300 |
commit | 50e3cd0bb3ffd92b7811887e99e69e581813c8ed (patch) | |
tree | bae4ded29833eeb8c74788ff22ecd688a50d158f /release/scripts/modules/bpy_extras | |
parent | 43973410f3c0a6ab17be3a7899c64fee1787c61e (diff) |
Keymap: option to export all keymaps
Useful to store a snapshot of the current keymap state
so changes to the default keymap are ignored.
Also useful for testing keymap export works properly.
Diffstat (limited to 'release/scripts/modules/bpy_extras')
-rw-r--r-- | release/scripts/modules/bpy_extras/keyconfig_utils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index 3a9570a57c4..0ff6595eca9 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -296,8 +296,10 @@ def _kmistr(kmi, is_modal): return "".join(s) -def keyconfig_export(wm, kc, filepath): - +def keyconfig_export( + wm, kc, filepath, *, + all_keymaps=False, +): f = open(filepath, "w") f.write("import bpy\n") @@ -327,7 +329,7 @@ def keyconfig_export(wm, kc, filepath): keymaps = [] edited_kc = FakeKeyConfig() for km in wm.keyconfigs.user.keymaps: - if km.is_user_modified: + if all_keymaps or km.is_user_modified: edited_kc.keymaps.append(km) # merge edited keymaps with non-default keyconfig, if it exists if kc != wm.keyconfigs.default: |