Skip to content

Commit

Permalink
Fix T51700: OBJ exporter would have inverted normals in some cases.
Browse files Browse the repository at this point in the history
Applying a matrix with non-uniform negative scaling to a mesh requires
normals (face winfing) to be inverted back to their original orientation!
  • Loading branch information
Bastien Montagne committed Jun 6, 2017
1 parent 9950f0a commit 473d074
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion io_scene_obj/__init__.py
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions io_scene_obj/export_obj.py
Expand Up @@ -397,6 +397,9 @@ def findVertexGroupName(face, vWeightMap):
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
Expand Down

0 comments on commit 473d074

Please sign in to comment.