From 70eada0ece98454bf9a0913973c68428ecbc127d Mon Sep 17 00:00:00 2001 From: Aurel W <aurel.w@gmail.com> Date: Mon, 21 Feb 2011 22:57:53 +0000 Subject: [PATCH] io_raw_mesh: fixes,.. already were done but gone 'lost' (no svn history, nothing in patch tracker,...). wtf?!? --- io_mesh_raw/__init__.py | 4 ++-- io_mesh_raw/export_raw.py | 4 ++-- io_mesh_raw/import_raw.py | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py index d5a0bd869..0b5023cfd 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 d683d670a..67b6a8925 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 4b5b7304c..eb7725856 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) -- GitLab