mirror of
https://github.com/blender/blender-addons.git
synced 2025-08-20 13:22:58 +00:00
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.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user