forked from bartvdbraak/blender
Patch from Mario Lapin, fixes [#7394] 3ds File Import is broken
This commit is contained in:
parent
7fb4c95503
commit
8ac1330b74
@ -6,9 +6,9 @@ Group: 'Import'
|
|||||||
Tooltip: 'Import from 3DS file format (.3ds)'
|
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/")
|
__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
|
||||||
__version__= '0.995'
|
__version__= '0.996'
|
||||||
__bpydoc__= '''\
|
__bpydoc__= '''\
|
||||||
|
|
||||||
3ds Importer
|
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).
|
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>
|
0.995 by Campbell Barton<br>
|
||||||
- workaround for buggy mesh vert delete
|
- workaround for buggy mesh vert delete
|
||||||
@ -319,6 +328,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
|||||||
contextMesh_vertls= None
|
contextMesh_vertls= None
|
||||||
contextMesh_facels= None
|
contextMesh_facels= None
|
||||||
contextMeshMaterials= {} # matname:[face_idxs]
|
contextMeshMaterials= {} # matname:[face_idxs]
|
||||||
|
contextMeshUV= None
|
||||||
|
|
||||||
TEXTURE_DICT={}
|
TEXTURE_DICT={}
|
||||||
MATDICT={}
|
MATDICT={}
|
||||||
@ -422,6 +432,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
|||||||
#a spare chunk
|
#a spare chunk
|
||||||
new_chunk= chunk()
|
new_chunk= chunk()
|
||||||
temp_chunk= chunk()
|
temp_chunk= chunk()
|
||||||
|
|
||||||
|
CreateBlenderObject = False
|
||||||
|
|
||||||
#loop through all the data for this chunk (previous chunk) and see what it is
|
#loop through all the data for this chunk (previous chunk) and see what it is
|
||||||
while (previous_chunk.bytes_read<previous_chunk.length):
|
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?
|
#is it an object chunk?
|
||||||
elif (new_chunk.ID==OBJECT):
|
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)
|
tempName= read_string(file)
|
||||||
contextObName= tempName
|
contextObName= tempName
|
||||||
new_chunk.bytes_read += len(tempName)+1
|
new_chunk.bytes_read += len(tempName)+1
|
||||||
@ -637,20 +663,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
|||||||
#contextMatrix_tx= None
|
#contextMatrix_tx= None
|
||||||
#print contextLamp.name,
|
#print contextLamp.name,
|
||||||
|
|
||||||
|
|
||||||
elif (new_chunk.ID==OBJECT_MESH):
|
elif (new_chunk.ID==OBJECT_MESH):
|
||||||
# print 'Found an OBJECT_MESH chunk'
|
## @@ PATCH
|
||||||
if contextMesh_facels != None: # Write context mesh if we have one.
|
print 'Found an OBJECT_MESH chunk'
|
||||||
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
|
|
||||||
|
|
||||||
elif (new_chunk.ID==OBJECT_VERTICES):
|
elif (new_chunk.ID==OBJECT_VERTICES):
|
||||||
'''
|
'''
|
||||||
@ -979,4 +994,4 @@ else:
|
|||||||
|
|
||||||
print 'TOTAL TIME: %.6f' % (Blender.sys.time() - TIME)
|
print 'TOTAL TIME: %.6f' % (Blender.sys.time() - TIME)
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user