Skip to content
Snippets Groups Projects
Commit a8fd59a0 authored by Campbell Barton's avatar Campbell Barton
Browse files

use nicer api functions for adding extension, and define enum items as static tuples.

parent 91a1998d
No related branches found
No related tags found
No related merge requests found
......@@ -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():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment