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>2012-03-11 20:11:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-11 20:11:37 +0400
commiteda1a04dc291760ac503e4dfb75f865169b6f0f7 (patch)
tree1f1b7079b6f15a8cace10ba9d327d48ab51cd808 /io_scene_obj
parentd277ce111d46fb3330e327a79475b3e146d7022b (diff)
patch [#30516] OBJ importer run out of memory fix
from Martijn Berger (juicyfruit) with some edits for efficient dict access.
Diffstat (limited to 'io_scene_obj')
-rw-r--r--io_scene_obj/import_obj.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index f8b36a9c..40da59db 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -383,7 +383,7 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
faces_split = []
verts_split = []
unique_materials_split = {}
- vert_remap = [-1] * len(verts_loc)
+ vert_remap = {}
face_split_dict[key] = (verts_split, faces_split, unique_materials_split, vert_remap)
@@ -393,13 +393,13 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
# Remap verts to new vert list and add where needed
for enum, i in enumerate(face_vert_loc_indices):
- if vert_remap[i] == -1:
- new_index = len(verts_split)
- vert_remap[i] = new_index # set the new remapped index so we only add once and can reference next time.
- face_vert_loc_indices[enum] = new_index # remap to the local index
+ map_index = vert_remap.get(i)
+ if map_index is None:
+ map_index = len(verts_split)
+ vert_remap[i] = map_index # set the new remapped index so we only add once and can reference next time.
verts_split.append(verts_loc[i]) # add the vert to the local verts
- else:
- face_vert_loc_indices[enum] = vert_remap[i] # remap to the local index
+
+ face_vert_loc_indices[enum] = map_index # remap to the local index
matname = face[2]
if matname and matname not in unique_materials_split: