Skip to content
Snippets Groups Projects
Commit 473d074b authored by Bastien Montagne's avatar Bastien Montagne
Browse files

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!
parent 9950f0a0
Branches
Tags
No related merge requests found
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
bl_info = { bl_info = {
"name": "Wavefront OBJ format", "name": "Wavefront OBJ format",
"author": "Campbell Barton, Bastien Montagne", "author": "Campbell Barton, Bastien Montagne",
"version": (2, 3, 3), "version": (2, 3, 4),
"blender": (2, 77, 0), "blender": (2, 77, 0),
"location": "File > Import-Export", "location": "File > Import-Export",
"description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures", "description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures",
......
...@@ -397,6 +397,9 @@ def write_file(filepath, objects, scene, ...@@ -397,6 +397,9 @@ def write_file(filepath, objects, scene,
continue continue
me.transform(EXPORT_GLOBAL_MATRIX * ob_mat) 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: if EXPORT_TRI:
# _must_ do this first since it re-allocs arrays # _must_ do this first since it re-allocs arrays
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment