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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-06-06 19:49:02 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-06-06 19:49:02 +0300
commit473d074b34b66d6f674bb2f06153533c9b636fd1 (patch)
treeb1439e47882c9473114ce27b619a666781ebd07f
parent9950f0a0c210c235d2b33808b768191d57df1ca5 (diff)
Fix T51700: OBJ exporter would have inverted normals in some cases.
Applying a matrix with non-uniform negative scaling to a mesh requires normals (face winfing) to be inverted back to their original orientation!
-rw-r--r--io_scene_obj/__init__.py2
-rw-r--r--io_scene_obj/export_obj.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index 6d1312ec..6e854b9e 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Wavefront OBJ format",
"author": "Campbell Barton, Bastien Montagne",
- "version": (2, 3, 3),
+ "version": (2, 3, 4),
"blender": (2, 77, 0),
"location": "File > Import-Export",
"description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures",
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 89613368..e28d607d 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -397,6 +397,9 @@ def write_file(filepath, objects, scene,
continue
me.transform(EXPORT_GLOBAL_MATRIX * ob_mat)
+ # If negative scaling, we have to invert the normals...
+ if ob_mat.determinant() < 0.0:
+ me.flip_normals()
if EXPORT_TRI:
# _must_ do this first since it re-allocs arrays