diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-09 20:08:04 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-10 18:25:48 +0300 |
commit | 227fafdfcf4fb441ba1b8477331d543d2cf087af (patch) | |
tree | 26a0ac762d8985007286884992194c690696cb46 /io_mesh_stl | |
parent | adb4f822ca2383ec269c529d62419f3e6998bd48 (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.py | 23 |
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) |