io_scene_3ds: cleanup texture handling #10
@ -731,8 +731,8 @@ def make_material_chunk(material, image):
|
||||
diffuse = []
|
||||
|
||||
for link in wrap.material.node_tree.links:
|
||||
if link.from_node.type == 'TEX_IMAGE' and link.to_node.type != 'BSDF_PRINCIPLED':
|
||||
diffuse = [link.from_node.image] if not wrap.normalmap_texture else None
|
||||
if link.from_node.type == 'TEX_IMAGE' and link.to_node.type == 'MIX_RGB':
|
||||
diffuse = [link.from_node.image]
|
||||
|
||||
if diffuse:
|
||||
if primary_tex == False:
|
||||
|
@ -323,7 +323,7 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
|
||||
contextMesh_smooth = None
|
||||
contextMeshUV = None
|
||||
|
||||
TEXTURE_DICT = {}
|
||||
#TEXTURE_DICT = {}
|
||||
MATDICT = {}
|
||||
|
||||
# Localspace variable names, faster.
|
||||
@ -379,23 +379,19 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
|
||||
else:
|
||||
bmat = MATDICT.get(matName)
|
||||
# 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
|
||||
for fidx in faces:
|
||||
bmesh.polygons[fidx].material_index = mat_idx
|
||||
|
||||
if uv_faces and img:
|
||||
for fidx in faces:
|
||||
bmesh.polygons[fidx].material_index = mat_idx
|
||||
# TODO: How to restore this?
|
||||
# uv_faces[fidx].image = img
|
||||
else:
|
||||
for fidx in faces:
|
||||
bmesh.polygons[fidx].material_index = mat_idx
|
||||
# if uv_faces and img:
|
||||
# for fidx in faces:
|
||||
# bmesh.polygons[fidx].material_index = mat_idx
|
||||
# # TODO: How to restore this?
|
||||
# # uv_faces[fidx].image = img
|
||||
# else:
|
||||
# for fidx in faces:
|
||||
# bmesh.polygons[fidx].material_index = mat_idx
|
||||
|
||||
if uv_faces:
|
||||
uvl = bmesh.uv_layers.active.data[:]
|
||||
|
Reference in New Issue
Block a user