diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-12-16 16:52:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-12-16 16:53:28 +0300 |
commit | 245450b1441208c2e5975dd061afe8040618d027 (patch) | |
tree | 98c3170052eee7e57a0be4c222f1a345d1b3f3d3 /release/scripts/modules | |
parent | 69c3f4a46d4621300ca2aa3ab778b24cb1713e95 (diff) |
Fix exported keymaps loading in 2.91 and older
The generated keymaps used a keyword argument that doesn't exist
in older Blender versions.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bl_keymap_utils/io.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/release/scripts/modules/bl_keymap_utils/io.py b/release/scripts/modules/bl_keymap_utils/io.py index 091cdbc2642..645a145f994 100644 --- a/release/scripts/modules/bl_keymap_utils/io.py +++ b/release/scripts/modules/bl_keymap_utils/io.py @@ -222,12 +222,21 @@ def keyconfig_export_as_data(wm, kc, filepath, *, all_keymaps=False): fw("]\n") fw("\n\n") fw("if __name__ == \"__main__\":\n") + + # We could remove this in the future, as loading new key-maps in older Blender versions + # makes less and less sense as Blender changes. + fw(" # Only add keywords that are supported.\n") + fw(" from bpy.app import version as blender_version\n") + fw(" keywords = {}\n") + fw(" if blender_version >= (2, 92, 0):\n") + fw(" keywords[\"keyconfig_version\"] = keyconfig_version\n") + fw(" import os\n") fw(" from bl_keymap_utils.io import keyconfig_import_from_data\n") fw(" keyconfig_import_from_data(\n") fw(" os.path.splitext(os.path.basename(__file__))[0],\n") fw(" keyconfig_data,\n") - fw(" keyconfig_version=keyconfig_version,\n") + fw(" **keywords,\n") fw(" )\n") |