Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-07-03 07:12:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-03 07:12:09 +0400
commita8fd59a0884cbbe9986d44838f8f39a7970e5534 (patch)
tree40c3d48643b145f11192d3d0c1f4805318625839 /io_export_directx_x.py
parent91a1998ddecfc5048b7c3639ec247c2c8bc27c92 (diff)
use nicer api functions for adding extension, and define enum items as static tuples.
Diffstat (limited to 'io_export_directx_x.py')
-rw-r--r--io_export_directx_x.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/io_export_directx_x.py b/io_export_directx_x.py
index 010baa80..7b36afa9 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():