Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-14 22:31:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-14 22:31:42 +0300
commit5722bc15cd193bf8c083e282c3ad36344aab3832 (patch)
treebc90473942dfa41e0314a2fc42e533f13b466dcb /io_mesh_stl/blender_utils.py
parent55c6ce612617ca2f5aca0ecefe4ddf381100f94a (diff)
bugfix [#25635] STL export results in error
also made some pep8 corrections
Diffstat (limited to 'io_mesh_stl/blender_utils.py')
-rw-r--r--io_mesh_stl/blender_utils.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py
index a043a8f3..751f2586 100644
--- a/io_mesh_stl/blender_utils.py
+++ b/io_mesh_stl/blender_utils.py
@@ -38,16 +38,20 @@ def faces_from_mesh(ob, apply_modifier=False, triangulate=True):
except SystemError:
return ()
- def iter_face_index():
- '''
- From a list of faces, return the face triangulated if needed.
- '''
- for face in mesh.faces:
- if triangulate and len(face.vertices) == 4:
- yield face.vertices[:3]
- yield face.vertices[2:] + [face.vertices[0]]
- else:
- yield list(face.vertices)
-
- return ([tuple(mesh.vertices[index].co * ob.matrix_world)
+ if triangulate:
+ # From a list of faces, return the face triangulated if needed.
+ def iter_face_index():
+ for face in mesh.faces:
+ vertices = face.vertices[:]
+ if len(vertices) == 4:
+ yield vertices[0], vertices[1], vertices[2]
+ yield vertices[2], vertices[3], vertices[0]
+ else:
+ yield vertices
+ else:
+ def iter_face_index():
+ for face in mesh.faces:
+ yield face.vertices[:]
+
+ return ([(mesh.vertices[index].co * ob.matrix_world)[:]
for index in indexes] for indexes in iter_face_index())