Keymap: set the default filepath exporting keymaps

Use the key-config name for the file name.
This commit is contained in:
Campbell Barton 2021-09-22 17:47:52 +10:00
parent ba313f8a74
commit 90b485845c
Notes: blender-bot 2023-02-14 06:00:46 +01:00
Referenced by issue #91602, FFMPEG: Video crashing since last FFMPEG SVN lib update
1 changed files with 7 additions and 1 deletions

View File

@ -268,7 +268,7 @@ class PREFERENCES_OT_keyconfig_export(Operator):
)
filepath: StringProperty(
subtype='FILE_PATH',
default="keymap.py",
default="",
)
filter_folder: BoolProperty(
name="Filter folders",
@ -307,7 +307,13 @@ class PREFERENCES_OT_keyconfig_export(Operator):
return {'FINISHED'}
def invoke(self, context, _event):
import os
wm = context.window_manager
if not self.filepath:
self.filepath = os.path.join(
os.path.expanduser("~"),
bpy.path.display_name_to_filepath(wm.keyconfigs.active.name) + ".py",
)
wm.fileselect_add(self)
return {'RUNNING_MODAL'}