X-Git-Url: https://git.sthu.org/?p=io_import_off.git;a=blobdiff_plain;f=io_import_off.py;h=6a608ed8cbbbfe95da7ebaf6336d3e26f945c40f;hp=86b825cace8b4b39aa4dd42e55164a9e5195ddea;hb=HEAD;hpb=271b7a5f58981e361a3d286f2c0b91970e6160cb diff --git a/io_import_off.py b/io_import_off.py index 86b825c..6a608ed 100644 --- a/io_import_off.py +++ b/io_import_off.py @@ -84,7 +84,7 @@ def unpack_faces(faces): # Rotate triangle, such that last index is not zero if tri[2] == 0: tri = [ tri[2], tri[0], tri[1] ] - + l.extend(tri) l.extend([0]) @@ -94,7 +94,7 @@ def unpack_faces(faces): def importFile(filepath, context): # List of vertices, a vertex is a 3-tuple (x,y,z) - vertices = [] + vertices = [] # List of faces, a face is a list of indices within vertices faces = [] @@ -135,7 +135,7 @@ def importFile(filepath, context): # Get all faces for n in range(numFaces): line = getNextLine(f).split() - + # Get number of vertices lenFace = int(line[0]) line = line[1:] @@ -156,9 +156,9 @@ def importFile(filepath, context): # Add given number of vertices and faces me.vertices.add( len(vertexdata)//3 ) - me.faces.add( len(facedata)//4 ) + me.tessfaces.add( len(facedata)//4 ) me.vertices.foreach_set("co", vertexdata) - me.faces.foreach_set("vertices_raw", facedata) + me.tessfaces.foreach_set("vertices_raw", facedata) me.update() ob = bpy.data.objects.new("Mesh", me) @@ -172,7 +172,7 @@ def importFile(filepath, context): print("Error reading .off file") print(e) return False - + class IMPORT_OT_dec_off(bpy.types.Operator):