[#23275] .3DS import script fails on some models.

- fixed reading meshes without faces.

also changed...
- read verts/faces/uvs in one struct.unpack(), should be a bit faster.
- removed mesh/material splitting, very confusing/slow code and not needed since the 16 material limit was removed.
- load image paths with bpy.path.resolve_ncase() since many 3ds's files has case mismatch with file names (applies to OBJ too).
This commit is contained in:
2010-08-12 02:24:12 +00:00
parent ac133d5d26
commit ffd65f49da
2 changed files with 85 additions and 140 deletions

View File

@@ -305,13 +305,14 @@ def load_image(imagepath, dirname):
if os.path.exists(imagepath):
return bpy.data.images.load(imagepath)
variants = [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
for path in variants:
if os.path.exists(path):
return bpy.data.images.load(path)
else:
print(path, "doesn't exist")
for filepath in variants:
for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
if os.path.exists(nfilepath):
return bpy.data.images.load(nfilepath)
print(filepath, "doesn't exist")
# TODO comprehensiveImageLoad also searched in bpy.config.textureDir
return None