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!
This commit is contained in:
Bastien Montagne 2017-06-06 18:49:02 +02:00
parent 9950f0a0c2
commit 473d074b34
Notes: blender-bot 2023-02-14 19:38:46 +01:00
Referenced by issue #51700, obj export error
2 changed files with 4 additions and 1 deletions

View File

@ -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",

View File

@ -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