From 93be85532ba2a3bf030f3211f201c0fe4e055d53 Mon Sep 17 00:00:00 2001 From: Chris Foster <cdbfoster@gmail.com> Date: Wed, 10 Apr 2013 21:47:33 +0000 Subject: [PATCH] Re-added Flip Normals option by request. Also removed WIP warning. --- io_scene_x/__init__.py | 10 +++++++--- io_scene_x/export_x.py | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/io_scene_x/__init__.py b/io_scene_x/__init__.py index f1fa1c4c8..519ca16cd 100644 --- a/io_scene_x/__init__.py +++ b/io_scene_x/__init__.py @@ -21,12 +21,11 @@ bl_info = { "name": "DirectX X Format", "author": "Chris Foster", - "version": (3, 0, 0), + "version": (3, 0, 1), "blender": (2, 66, 0), "location": "File > Export > DirectX (.x)", "description": "Export mesh vertices, UV's, materials, textures, "\ "vertex colors, armatures, empties, and actions.", - "warning": "This script is a WIP!", "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\ "Scripts/Import-Export/DirectX_Exporter", "tracker_url": "https://projects.blender.org/tracker/index.php?"\ @@ -64,6 +63,11 @@ class ExportDirectX(bpy.types.Operator): description="Export mesh normals", default=True) + FlipNormals = BoolProperty( + name=" Flip Normals", + description="Flip mesh normals before export", + default=False) + ExportUVCoordinates = BoolProperty( name=" Export UV Coordinates", description="Export mesh UV coordinates, if any", @@ -134,7 +138,7 @@ class ExportDirectX(bpy.types.Operator): def execute(self, context): self.filepath = bpy.path.ensure_ext(self.filepath, ".x") - import export_x + from . import export_x Exporter = export_x.DirectXExporter(self, context) Exporter.Export() return {'FINISHED'} diff --git a/io_scene_x/export_x.py b/io_scene_x/export_x.py index 3aa2b9098..75fbf5659 100644 --- a/io_scene_x/export_x.py +++ b/io_scene_x/export_x.py @@ -550,6 +550,9 @@ class MeshExportObject(ExportObject): # Write mesh normals. for Index, Vertex in enumerate(MeshEnumerator.vertices): Normal = Vertex.normal + if self.Config.FlipNormals: + Normal = -1.0 * Vertex.normal + self.Exporter.File.Write("{:9f};{:9f};{:9f};".format(Normal[0], Normal[1], Normal[2])) -- GitLab