From 473d074b34b66d6f674bb2f06153533c9b636fd1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 6 Jun 2017 18:49:02 +0200 Subject: 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! --- io_scene_obj/__init__.py | 2 +- io_scene_obj/export_obj.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3