diff --git a/io_export_directx_x.py b/io_export_directx_x.py index 010baa80143e0563c60dc33a637da2b57e57c65a..7b36afa9e0d607a2495e48af6f904785331197bb 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -1164,20 +1164,26 @@ def CloseFile(Config): if Config.Verbose: print("Done") -CoordinateSystems = [] -CoordinateSystems.append(("1", "Left-Handed", "")) -CoordinateSystems.append(("2", "Right-Handed", "")) -AnimationModes = [] -AnimationModes.append(("0", "None", "")) -AnimationModes.append(("1", "Keyframes Only", "")) -AnimationModes.append(("2", "Full Animation", "")) +CoordinateSystems = ( + ("1", "Left-Handed", ""), + ("2", "Right-Handed", ""), + ) -ExportModes = [] -ExportModes.append(("1", "All Objects", "")) -ExportModes.append(("2", "Selected Objects", "")) -from bpy.props import * +AnimationModes = ( + ("0", "None", ""), + ("1", "Keyframes Only", ""), + ("2", "Full Animation", ""), + ) + +ExportModes = ( + ("1", "All Objects", ""), + ("2", "Selected Objects", ""), + ) + + +from bpy.props import StringProperty, EnumProperty, BoolProperty class DirectXExporter(bpy.types.Operator): @@ -1207,7 +1213,7 @@ class DirectXExporter(bpy.types.Operator): def execute(self, context): #Append .x - FilePath = os.path.splitext(self.filepath)[0] + ".x" + FilePath = bpy.path.ensure_ext(self.filepath, ".x") Config = DirectXExporterSettings(context, FilePath, @@ -1221,18 +1227,20 @@ class DirectXExporter(bpy.types.Operator): ExportAnimation=self.ExportAnimation, ExportMode=self.ExportMode, Verbose=self.Verbose) + ExportDirectX(Config) return {"FINISHED"} def invoke(self, context, event): + if not self.filepath: + self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".x") WindowManager = context.window_manager WindowManager.fileselect_add(self) return {"RUNNING_MODAL"} def menu_func(self, context): - default_path = os.path.splitext(bpy.data.filepath)[0] + ".x" - self.layout.operator(DirectXExporter.bl_idname, text="DirectX (.x)").filepath = default_path + self.layout.operator(DirectXExporter.bl_idname, text="DirectX (.x)") def register():