diff options
Diffstat (limited to 'release/scripts/3ds_import.py')
-rw-r--r-- | release/scripts/3ds_import.py | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/release/scripts/3ds_import.py b/release/scripts/3ds_import.py index 07da4df1603..028b9633606 100644 --- a/release/scripts/3ds_import.py +++ b/release/scripts/3ds_import.py @@ -6,9 +6,9 @@ Group: 'Import' Tooltip: 'Import from 3DS file format (.3ds)' """ -__author__= ['Bob Holcomb', 'Richard L?rk?ng', 'Damien McGinnes', 'Campbell Barton'] +__author__= ['Bob Holcomb', 'Richard L?rk?ng', 'Damien McGinnes', 'Campbell Barton', 'Mario Lapin'] __url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/") -__version__= '0.995' +__version__= '0.996' __bpydoc__= '''\ 3ds Importer @@ -17,6 +17,15 @@ This script imports a 3ds file and the materials into Blender for editing. Loader is based on 3ds loader from www.gametutorials.com (Thanks DigiBen). +0.996 by Mario Lapin (mario.lapin@gmail.com) 13/04/200 <br> + - Implemented workaround to correct association between name, geometry and materials of + imported meshes. + + Without this patch, version 0.995 of this importer would associate to each mesh object the + geometry and the materials of the previously parsed mesh object. By so, the name of the + first mesh object would be thrown away, and the name of the last mesh object would be + automatically merged with a '.001' at the end. No object would desappear, however object's + names and materials would be completely jumbled. 0.995 by Campbell Barton<br> - workaround for buggy mesh vert delete @@ -319,6 +328,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): contextMesh_vertls= None contextMesh_facels= None contextMeshMaterials= {} # matname:[face_idxs] + contextMeshUV= None TEXTURE_DICT={} MATDICT={} @@ -409,7 +419,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): ob.setMatrix(contextMatrix_rot) importedObjects.append(ob) - + bmesh.calcNormals() for matName, faces in myContextMeshMaterials.iteritems(): makeMeshMaterialCopy(matName, faces) @@ -422,6 +432,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): #a spare chunk new_chunk= chunk() temp_chunk= chunk() + + CreateBlenderObject = False #loop through all the data for this chunk (previous chunk) and see what it is while (previous_chunk.bytes_read<previous_chunk.length): @@ -454,6 +466,20 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): #is it an object chunk? elif (new_chunk.ID==OBJECT): + + if CreateBlenderObject: + putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials) + contextMesh_vertls= []; contextMesh_facels= [] + + ## preparando para receber o proximo objeto + contextMeshMaterials= {} # matname:[face_idxs] + contextMeshUV= None + #contextMesh.vertexUV= 1 # Make sticky coords. + # Reset matrix + contextMatrix_rot= None + #contextMatrix_tx= None + + CreateBlenderObject= True tempName= read_string(file) contextObName= tempName new_chunk.bytes_read += len(tempName)+1 @@ -637,21 +663,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): #contextMatrix_tx= None #print contextLamp.name, - elif (new_chunk.ID==OBJECT_MESH): # print 'Found an OBJECT_MESH chunk' - if contextMesh_facels != None: # Write context mesh if we have one. - putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials) - - contextMesh_vertls= []; contextMesh_facels= [] - - contextMeshMaterials= {} # matname:[face_idxs] - contextMeshUV= None - #contextMesh.vertexUV= 1 # Make sticky coords. - # Reset matrix - contextMatrix_rot= None - #contextMatrix_tx= None - + pass elif (new_chunk.ID==OBJECT_VERTICES): ''' Worldspace vertex locations @@ -979,4 +993,4 @@ else: print 'TOTAL TIME: %.6f' % (Blender.sys.time() - TIME) -'''
\ No newline at end of file +''' |