New Addon: Import Autodesk .max #105013
@ -650,12 +650,15 @@ def make_material_texture_chunk(chunk_id, texslots, pct):
|
|||||||
mat_sub_angle.add_variable("mapangle", _3ds_float(round(texslot.rotation[2], 6)))
|
mat_sub_angle.add_variable("mapangle", _3ds_float(round(texslot.rotation[2], 6)))
|
||||||
mat_sub.add_subchunk(mat_sub_angle)
|
mat_sub.add_subchunk(mat_sub_angle)
|
||||||
|
|
||||||
if texslot.socket_dst.identifier in {'Base Color', 'Specular Tint'}:
|
if texslot.socket_dst.identifier in {'Base Color', 'Specular Tint'}: # Add tint color
|
||||||
rgb = _3ds_chunk(MAP_COL1) # Add tint color
|
tint = texslot.socket_dst.identifier == 'Base Color' and texslot.image.colorspace_settings.name == 'Non-Color'
|
||||||
base = texslot.owner_shader.material.diffuse_color[:3]
|
if tint or texslot.socket_dst.identifier == 'Specular Tint':
|
||||||
spec = texslot.owner_shader.material.specular_color[:]
|
tint1 = _3ds_chunk(MAP_COL1)
|
||||||
rgb.add_variable("mapcolor", _3ds_rgb_color(spec if texslot.socket_dst.identifier == 'Specular Tint' else base))
|
tint2 = _3ds_chunk(MAP_COL2)
|
||||||
mat_sub.add_subchunk(rgb)
|
tint1.add_variable("tint1", _3ds_rgb_color(texslot.node_dst.inputs['Coat Tint'].default_value[:3]))
|
||||||
|
tint2.add_variable("tint2", _3ds_rgb_color(texslot.node_dst.inputs['Sheen Tint'].default_value[:3]))
|
||||||
|
mat_sub.add_subchunk(tint1)
|
||||||
|
mat_sub.add_subchunk(tint2)
|
||||||
|
|
||||||
# Store all textures for this mapto in order. This at least is what the
|
# Store all textures for this mapto in order. This at least is what the
|
||||||
# 3DS exporter did so far, afaik most readers will just skip over 2nd textures
|
# 3DS exporter did so far, afaik most readers will just skip over 2nd textures
|
||||||
|
@ -274,6 +274,10 @@ def add_texture_to_material(image, contextWrapper, pct, extend, alpha, scale, of
|
|||||||
elif mapto == 'SPECULARITY':
|
elif mapto == 'SPECULARITY':
|
||||||
shader.location = (300,0)
|
shader.location = (300,0)
|
||||||
img_wrap = contextWrapper.specular_tint_texture
|
img_wrap = contextWrapper.specular_tint_texture
|
||||||
|
if tint1:
|
||||||
|
img_wrap.node_dst.inputs['Coat Tint'].default_value = tint1[:3] + [1]
|
||||||
|
if tint2:
|
||||||
|
img_wrap.node_dst.inputs['Sheen Tint'].default_value = tint2[:3] + [1]
|
||||||
elif mapto == 'ALPHA':
|
elif mapto == 'ALPHA':
|
||||||
shader.location = (-300,0)
|
shader.location = (-300,0)
|
||||||
img_wrap = contextWrapper.alpha_texture
|
img_wrap = contextWrapper.alpha_texture
|
||||||
@ -324,8 +328,11 @@ def add_texture_to_material(image, contextWrapper, pct, extend, alpha, scale, of
|
|||||||
own_map = img_wrap.node_mapping
|
own_map = img_wrap.node_mapping
|
||||||
if tex == image.name:
|
if tex == image.name:
|
||||||
links.new(link.from_node.outputs['Alpha'], img_wrap.socket_dst)
|
links.new(link.from_node.outputs['Alpha'], img_wrap.socket_dst)
|
||||||
|
try:
|
||||||
nodes.remove(own_map)
|
nodes.remove(own_map)
|
||||||
nodes.remove(own_node)
|
nodes.remove(own_node)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
for imgs in bpy.data.images:
|
for imgs in bpy.data.images:
|
||||||
if imgs.name[-3:].isdigit():
|
if imgs.name[-3:].isdigit():
|
||||||
if not imgs.users:
|
if not imgs.users:
|
||||||
|
Loading…
Reference in New Issue
Block a user