io_scene_3ds: cleanup texture handling #10
@ -323,7 +323,7 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
|
|||||||
contextMesh_smooth = None
|
contextMesh_smooth = None
|
||||||
contextMeshUV = None
|
contextMeshUV = None
|
||||||
|
|
||||||
TEXTURE_DICT = {}
|
#TEXTURE_DICT = {}
|
||||||
MATDICT = {}
|
MATDICT = {}
|
||||||
|
|
||||||
# Localspace variable names, faster.
|
# Localspace variable names, faster.
|
||||||
@ -379,23 +379,19 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
|
|||||||
else:
|
else:
|
||||||
bmat = MATDICT.get(matName)
|
bmat = MATDICT.get(matName)
|
||||||
# in rare cases no materials defined.
|
# in rare cases no materials defined.
|
||||||
if bmat:
|
|
||||||
img = TEXTURE_DICT.get(bmat.name)
|
|
||||||
else:
|
|
||||||
print(" warning: material %r not defined!" % matName)
|
|
||||||
bmat = MATDICT[matName] = bpy.data.materials.new(matName)
|
|
||||||
img = None
|
|
||||||
|
|
||||||
bmesh.materials.append(bmat) # can be None
|
bmesh.materials.append(bmat) # can be None
|
||||||
|
for fidx in faces:
|
||||||
|
bmesh.polygons[fidx].material_index = mat_idx
|
||||||
|
|
||||||
if uv_faces and img:
|
# if uv_faces and img:
|
||||||
for fidx in faces:
|
# for fidx in faces:
|
||||||
bmesh.polygons[fidx].material_index = mat_idx
|
# bmesh.polygons[fidx].material_index = mat_idx
|
||||||
# TODO: How to restore this?
|
# # TODO: How to restore this?
|
||||||
# uv_faces[fidx].image = img
|
# # uv_faces[fidx].image = img
|
||||||
else:
|
# else:
|
||||||
for fidx in faces:
|
# for fidx in faces:
|
||||||
bmesh.polygons[fidx].material_index = mat_idx
|
# bmesh.polygons[fidx].material_index = mat_idx
|
||||||
|
|
||||||
if uv_faces:
|
if uv_faces:
|
||||||
uvl = bmesh.uv_layers.active.data[:]
|
uvl = bmesh.uv_layers.active.data[:]
|
||||||
|
Reference in New Issue
Block a user