diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-12 16:45:40 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-12 16:56:24 +0300 |
commit | 3c2a3f8a60d68b131d0ec606e28f8795327651df (patch) | |
tree | 03f7cd8e32bf5a219105f43ec8d6e809fe8ea989 /io_scene_obj | |
parent | 234cf14fe72afd2ab3433935465a01307d2465f0 (diff) |
Update for node_shader_utils changes.
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/export_obj.py | 4 | ||||
-rw-r--r-- | io_scene_obj/import_obj.py | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 86f84da7..f3b92afd 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -82,7 +82,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): fw('Ka %.6f %.6f %.6f\n' % (mat_wrap.metallic, mat_wrap.metallic, mat_wrap.metallic)) else: fw('Ka %.6f %.6f %.6f\n' % (1.0, 1.0, 1.0)) - fw('Kd %.6f %.6f %.6f\n' % mat_wrap.diffuse_color[:3]) # Diffuse + fw('Kd %.6f %.6f %.6f\n' % mat_wrap.base_color[:3]) # Diffuse # XXX TODO Find a way to handle tint and diffuse color, in a consistent way with import... fw('Ks %.6f %.6f %.6f\n' % (mat_wrap.specular, mat_wrap.specular, mat_wrap.specular)) # Specular # Emission, not in original MTL standard but seems pretty common, see T45766. @@ -108,7 +108,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): #### And now, the image textures... image_map = { - "map_Kd": "diffuse_texture", + "map_Kd": "base_color_texture", "map_Ka": None, # ambient... "map_Ks": "specular_texture", "map_Ns": "roughness_texture", diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index 55e7648c..2bf4ac94 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -133,7 +133,7 @@ def create_materials(filepath, relpath, # Adds textures for materials (rendering) if type == 'Kd': - _generic_tex_set(mat_wrap.diffuse_texture, image, 'UV', map_offset, map_scale) + _generic_tex_set(mat_wrap.base_color_texture, image, 'UV', map_offset, map_scale) elif type == 'Ka': # XXX Not supported? @@ -168,8 +168,8 @@ def create_materials(filepath, relpath, print("WARNING, unsupported reflection type '%s', defaulting to 'sphere'" "" % ' '.join(i.decode() for i in map_type)) - _generic_tex_set(mat_wrap.diffuse_texture, image, 'Reflection', map_offset, map_scale) - mat_wrap.diffuse_texture.projection = 'SPHERE' + _generic_tex_set(mat_wrap.base_color_texture, image, 'Reflection', map_offset, map_scale) + mat_wrap.base_color_texture.projection = 'SPHERE' else: raise Exception("invalid type %r" % type) @@ -227,8 +227,8 @@ def create_materials(filepath, relpath, # from some grey), and apply the the proportion between those two as tint factor? # ~ spec = sum(spec_color) / 3.0 # ~ spec_var = math.sqrt(sum((c - spec) ** 2 for c in spec_color) / 3.0) - # ~ diff = sum(context_mat_wrap.diffuse_color[:3]) / 3.0 - # ~ diff_var = math.sqrt(sum((c - diff) ** 2 for c in context_mat_wrap.diffuse_color[:3]) / 3.0) + # ~ diff = sum(context_mat_wrap.base_color) / 3.0 + # ~ diff_var = math.sqrt(sum((c - diff) ** 2 for c in context_mat_wrap.base_color) / 3.0) # ~ tint = min(1.0, spec_var / diff_var) context_mat_wrap.specular = spec context_mat_wrap.specular_tint = 0.0 @@ -293,7 +293,7 @@ def create_materials(filepath, relpath, context_material_vars.add("metallic") elif line_id == b'kd': col = (float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])) - context_mat_wrap.diffuse_color[:3] = col + context_mat_wrap.base_color = col elif line_id == b'ks': spec_color = (float_func(line_split[1]) + float_func(line_split[2]) + float_func(line_split[3])) context_material_vars.add("specular") |