Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Sat, 14 Jul 2018 08:22:15 +0000 (10:22 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 14 Jul 2018 08:27:07 +0000 (10:27 +0200)
release/scripts/modules/bpy_extras/keyconfig_utils.py
release/scripts/modules/bpy_extras/keyconfig_utils_experimental.py
release/scripts/startup/bl_operators/wm.py

index 7e5e1fb855cd056703041349cf2880051b0787fa..6859e327b6674854351574bc3da0adb57499828b 100644 (file)
@@ -295,8 +295,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")
@@ -326,7 +328,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:
index a0ea87d1c93be030ae89db0d816263822c442ce4..6e7b0205a65d5ed44565d2b8ab9fdc35f662526b 100644 (file)
@@ -122,7 +122,7 @@ def _kmi_attrs_or_none(level, kmi):
     return "".join(lines)
 
 
-def keyconfig_export_as_data(wm, kc, filepath):
+def keyconfig_export_as_data(wm, kc, filepath, *, all_keymaps=False):
     # Alternate foramt
 
     # Generate a list of keymaps to export:
@@ -140,7 +140,7 @@ def keyconfig_export_as_data(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:
index fe3679733236634f1af7f9f0bec43fc57ab62077..cfbc96696d6029f9f58f72b3709566fe94800901 100644 (file)
@@ -1608,6 +1608,11 @@ class WM_OT_keyconfig_export(Operator):
     bl_idname = "wm.keyconfig_export"
     bl_label = "Export Key Configuration..."
 
+    all: BoolProperty(
+        name="All Keymaps",
+        default=False,
+        description="Write all keymaps (not just user modified)",
+    )
     filepath: StringProperty(
         subtype='FILE_PATH',
         default="keymap.py",
@@ -1643,6 +1648,7 @@ class WM_OT_keyconfig_export(Operator):
             wm,
             wm.keyconfigs.active,
             self.filepath,
+            all_keymaps=self.all,
         )
 
         return {'FINISHED'}