io_scene_3ds: Moved specular color texture to specular tint #104918
@ -18,7 +18,7 @@ import bpy
|
|||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "Autodesk 3DS format",
|
"name": "Autodesk 3DS format",
|
||||||
"author": "Bob Holcomb, Campbell Barton, Sebastian Schrand",
|
"author": "Bob Holcomb, Campbell Barton, Sebastian Schrand",
|
||||||
"version": (2, 4, 7),
|
"version": (2, 4, 8),
|
||||||
"blender": (4, 0, 0),
|
"blender": (4, 0, 0),
|
||||||
"location": "File > Import-Export",
|
"location": "File > Import-Export",
|
||||||
"description": "3DS Import/Export meshes, UVs, materials, textures, "
|
"description": "3DS Import/Export meshes, UVs, materials, textures, "
|
||||||
|
@ -620,7 +620,7 @@ def make_material_texture_chunk(chunk_id, texslots, pct):
|
|||||||
|
|
||||||
if socket == 'Alpha':
|
if socket == 'Alpha':
|
||||||
mapflags |= 0x40
|
mapflags |= 0x40
|
||||||
if texslot.socket_dst.identifier in {'Base Color', 'Specular IOR Level'}:
|
if texslot.socket_dst.identifier in {'Base Color', 'Specular Tint'}:
|
||||||
mapflags |= 0x80 if image.colorspace_settings.name == 'Non-Color' else 0x200
|
mapflags |= 0x80 if image.colorspace_settings.name == 'Non-Color' else 0x200
|
||||||
|
|
||||||
mat_sub_mapflags.add_variable("mapflags", _3ds_ushort(mapflags))
|
mat_sub_mapflags.add_variable("mapflags", _3ds_ushort(mapflags))
|
||||||
@ -650,11 +650,11 @@ 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 IOR Level'}:
|
if texslot.socket_dst.identifier in {'Base Color', 'Specular Tint'}:
|
||||||
rgb = _3ds_chunk(MAP_COL1) # Add tint color
|
rgb = _3ds_chunk(MAP_COL1) # Add tint color
|
||||||
base = texslot.owner_shader.material.diffuse_color[:3]
|
base = texslot.owner_shader.material.diffuse_color[:3]
|
||||||
spec = texslot.owner_shader.material.specular_color[:]
|
spec = texslot.owner_shader.material.specular_color[:]
|
||||||
rgb.add_variable("mapcolor", _3ds_rgb_color(spec if texslot.socket_dst.identifier == 'Specular IOR Level' else base))
|
rgb.add_variable("mapcolor", _3ds_rgb_color(spec if texslot.socket_dst.identifier == 'Specular Tint' else base))
|
||||||
mat_sub.add_subchunk(rgb)
|
mat_sub.add_subchunk(rgb)
|
||||||
|
|
||||||
# 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
|
||||||
@ -724,8 +724,8 @@ def make_material_chunk(material, image):
|
|||||||
material_chunk.add_subchunk(make_texture_chunk(MAT_DIFFUSEMAP, mxtex, mxpct))
|
material_chunk.add_subchunk(make_texture_chunk(MAT_DIFFUSEMAP, mxtex, mxpct))
|
||||||
primary_tex = True
|
primary_tex = True
|
||||||
|
|
||||||
if wrap.specular_texture:
|
if wrap.specular_tint_texture:
|
||||||
spec = [wrap.specular_texture]
|
spec = [wrap.specular_tint_texture]
|
||||||
s_pct = material.specular_intensity
|
s_pct = material.specular_intensity
|
||||||
matmap = make_material_texture_chunk(MAT_SPECMAP, spec, s_pct)
|
matmap = make_material_texture_chunk(MAT_SPECMAP, spec, s_pct)
|
||||||
if matmap:
|
if matmap:
|
||||||
|
@ -264,7 +264,7 @@ def add_texture_to_material(image, contextWrapper, pct, extend, alpha, scale, of
|
|||||||
links.new(img_wrap.node_image.outputs['Color'], mixer.inputs[2])
|
links.new(img_wrap.node_image.outputs['Color'], mixer.inputs[2])
|
||||||
links.new(mixer.outputs['Color'], shader.inputs['Base Color'])
|
links.new(mixer.outputs['Color'], shader.inputs['Base Color'])
|
||||||
elif mapto == 'SPECULARITY':
|
elif mapto == 'SPECULARITY':
|
||||||
img_wrap = contextWrapper.specular_texture
|
img_wrap = contextWrapper.specular_tint_texture
|
||||||
elif mapto == 'ALPHA':
|
elif mapto == 'ALPHA':
|
||||||
shader.location = (0, -300)
|
shader.location = (0, -300)
|
||||||
img_wrap = contextWrapper.alpha_texture
|
img_wrap = contextWrapper.alpha_texture
|
||||||
|
Loading…
Reference in New Issue
Block a user