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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-09 20:08:04 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-10 18:25:48 +0300
commit227fafdfcf4fb441ba1b8477331d543d2cf087af (patch)
tree26a0ac762d8985007286884992194c690696cb46 /io_mesh_stl
parentadb4f822ca2383ec269c529d62419f3e6998bd48 (diff)
Update for removal of tessfaces.
This ports the already working addons. The disabled x3d, psk, lwo, 3ds, raw, dxf addons still need to be converted.
Diffstat (limited to 'io_mesh_stl')
-rw-r--r--io_mesh_stl/blender_utils.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py
index 3c895560..ee5cb098 100644
--- a/io_mesh_stl/blender_utils.py
+++ b/io_mesh_stl/blender_utils.py
@@ -63,7 +63,7 @@ def create_and_link_mesh(name, faces, face_nors, points, global_matrix):
obj.select_set("SELECT")
-def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False, triangulate=True):
+def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False):
"""
From an object, return a generator over a list of faces.
@@ -90,26 +90,11 @@ def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False, triangulate=Tru
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.
- def iter_face_index():
- for face in mesh.tessfaces:
- 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.tessfaces:
- yield face.vertices[:]
+ mesh.calc_loop_triangles()
vertices = mesh.vertices
- for indexes in iter_face_index():
- yield [vertices[index].co.copy() for index in indexes]
+ for tri in mesh.loop_triangles:
+ yield [vertices[index].co.copy() for index in tri.vertices]
bpy.data.meshes.remove(mesh)