Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-08-27 03:31:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-27 03:31:22 +0400
commitd7752e1b50740a81f1196063ee3466be0f2b5150 (patch)
treef4ded7c5c3f80d5878745ae4881b59b630e8153b /io_mesh_raw
parent8d941d5a9d675a9a4ef7700f69a2b59efd6bf7b2 (diff)
update for rna api changes
Diffstat (limited to 'io_mesh_raw')
-rw-r--r--io_mesh_raw/import_raw.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/io_mesh_raw/import_raw.py b/io_mesh_raw/import_raw.py
index e8a7a4a7..850f7002 100644
--- a/io_mesh_raw/import_raw.py
+++ b/io_mesh_raw/import_raw.py
@@ -78,19 +78,22 @@ def readMesh(filename, objName):
# Generate verts and faces lists, without duplicates
verts = []
coords = {}
- index = 0
-
+ index_tot = 0
+
for f in faces:
for i, v in enumerate(f):
- try:
- f[i] = coords[v]
- except:
- f[i] = coords[v] = index
- index += 1
+ index = coords.get(v)
+
+ if index is None:
+ index = coords[v] = index_tot
+ index_tot += 1
verts.append(v)
+ fi[i] = index
+
mesh = bpy.data.meshes.new(objName)
- mesh.add_geometry(int(len(verts)), 0, int(len(faces)))
+ 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))