diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py index d5a0bd8699f7c82b31a13c610fce7a9fc3eb19ae..0b5023cfdaf6a3745820f845c71d4e2077e16a08 100644 --- a/io_mesh_raw/__init__.py +++ b/io_mesh_raw/__init__.py @@ -20,8 +20,8 @@ bl_info = { "name": "Raw mesh", "author": "Anthony D,Agostino (Scorpius), Aurel Wildfellner", "version": (0, 2), - "blender": (2, 5, 3), - "api": 31667, + "blender": (2, 5, 6), + "api": 35040, "location": "File > Import-Export > Raw faces ", "description": "Import Raw Faces (.raw format)", "warning": "", diff --git a/io_mesh_raw/export_raw.py b/io_mesh_raw/export_raw.py index d683d670a363dcafc44b211b28539eb3814eb64f..67b6a89252e7955dcfdfbc20a6e9af8201d658d9 100644 --- a/io_mesh_raw/export_raw.py +++ b/io_mesh_raw/export_raw.py @@ -49,8 +49,8 @@ def faceToTriangles(face): def faceValues(face, mesh, matrix): fv = [] - for verti in face.vertices_raw: - fv.append(matrix * mesh.vertices[verti].co) + for verti in face.vertices: + fv.append(mesh.vertices[verti].co * matrix) return fv diff --git a/io_mesh_raw/import_raw.py b/io_mesh_raw/import_raw.py index 4b5b7304c525a5ee26605b7a5f5a97ea6e547f1b..eb772585699a3794f457922f3f835733abde8b9c 100644 --- a/io_mesh_raw/import_raw.py +++ b/io_mesh_raw/import_raw.py @@ -79,8 +79,10 @@ def readMesh(filename, objName): verts = [] coords = {} index_tot = 0 + faces_indices = [] for f in faces: + fi = [] for i, v in enumerate(f): index = coords.get(v) @@ -89,13 +91,12 @@ def readMesh(filename, objName): index_tot += 1 verts.append(v) - fi[i] = index + fi.append(index) + + faces_indices.append(fi) mesh = bpy.data.meshes.new(objName) - mesh.vertices.add(len(verts)) - mesh.faces.add(len(faces)) - mesh.vertices.foreach_set("co", unpack_list(verts)) - mesh.faces.foreach_set("vertices_raw", unpack_face_list(faces)) + mesh.from_pydata(verts, [], faces_indices) return mesh @@ -129,7 +130,7 @@ class RawImporter(bpy.types.Operator): def execute(self, context): #convert the filename to an object name - objName = bpy.path.display_name(self.filename.split("\\")[-1].split("/")[-1]) + objName = bpy.path.display_name(self.filepath.split("\\")[-1].split("/")[-1]) mesh = readMesh(self.filepath, objName) addMeshObj(mesh, objName)