diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 86f84da771bc40a87186222c507c1e97f444e35e..f3b92afd6c85c3d411d08d7e01636b6a5fbc3d0c 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 55e7648c9a01e5a386ed3b0b3e2a8c0b24b29e7c..2bf4ac94009a7404fdb864261a331b4164a0d60f 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")