[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3084] trunk/py/scripts/addons/ io_scene_obj/import_obj.py: patch [#30516] OBJ importer run out of memory fix
Campbell Barton
ideasman42 at gmail.com
Sun Mar 11 17:11:46 CET 2012
Revision: 3084
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3084
Author: campbellbarton
Date: 2012-03-11 16:11:37 +0000 (Sun, 11 Mar 2012)
Log Message:
-----------
patch [#30516] OBJ importer run out of memory fix
from Martijn Berger (juicyfruit)
with some edits for efficient dict access.
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_obj/import_obj.py
Modified: trunk/py/scripts/addons/io_scene_obj/import_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/import_obj.py 2012-03-10 20:51:55 UTC (rev 3083)
+++ trunk/py/scripts/addons/io_scene_obj/import_obj.py 2012-03-11 16:11:37 UTC (rev 3084)
@@ -383,7 +383,7 @@
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,14 +393,14 @@
# 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:
unique_materials_split[matname] = unique_materials[matname]
More information about the Bf-extensions-cvs
mailing list