[#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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user