[Bf-extensions-cvs] [0f2f0e4] master: Fix T47490: STL: faces not normalized correctly when exporting multiple meshes.
Bastien Montagne
noreply at git.blender.org
Sun Feb 28 16:49:22 CET 2016
Commit: 0f2f0e49517612db379f7f2958b1d1967e7e9e19
Author: Bastien Montagne
Date: Sun Feb 28 16:48:08 2016 +0100
Branches: master
https://developer.blender.org/rBA0f2f0e49517612db379f7f2958b1d1967e7e9e19
Fix T47490: STL: faces not normalized correctly when exporting multiple meshes.
Using new `mesh.flip_normals()` when the mesh is transformed with a negative matrix (mirror along one axis e.g.).
===================================================================
M io_mesh_stl/blender_utils.py
===================================================================
diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py
index a5492d0..864335a 100644
--- a/io_mesh_stl/blender_utils.py
+++ b/io_mesh_stl/blender_utils.py
@@ -88,7 +88,11 @@ def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False, triangulate=Tru
except RuntimeError:
raise StopIteration
- mesh.transform(global_matrix * ob.matrix_world)
+ mat = global_matrix * ob.matrix_world
+ mesh.transform(mat)
+ if mat.is_negative:
+ mesh.flip_normals()
+ mesh.calc_tessface()
if triangulate:
# From a list of faces, return the face triangulated if needed.
More information about the Bf-extensions-cvs
mailing list