From 0a096f2be233b6faca468a1add615fb72e57909e Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Thu, 11 Aug 2022 15:51:36 +0300 Subject: Fix T98781: OBJ exporter wrongly writing default material socket values when textures are present Report T98781 and part of T97642: the MTLMaterial info only captures image nodes and the default socket values. When the image information is present, do not emit the socket defaults - the .MTL spec states they are multiplied together, but the default value is not used in blender when the socket is connected. Also contains svn tests repository update to extend the test coverage, and update test expectation outputs. --- source/blender/io/wavefront_obj/importer/obj_import_mtl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/io/wavefront_obj/importer') diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc index 27bb5aa0d71..02e09a77a5d 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc @@ -342,7 +342,7 @@ void ShaderNodetreeWrap::set_bsdf_socket_values(Material *mat) if (emission_color.x >= 0 && emission_color.y >= 0 && emission_color.z >= 0) { set_property_of_socket(SOCK_RGBA, "Emission", {emission_color, 3}, bsdf_); } - if (mtl_mat_.texture_maps.contains_as(eMTLSyntaxElement::map_Ke)) { + if (mtl_mat_.tex_map_of_type(eMTLSyntaxElement::map_Ke).is_valid()) { set_property_of_socket(SOCK_FLOAT, "Emission Strength", {1.0f}, bsdf_); } set_property_of_socket(SOCK_FLOAT, "Specular", {specular}, bsdf_); @@ -365,7 +365,7 @@ void ShaderNodetreeWrap::add_image_textures(Main *bmain, Material *mat, bool rel { for (const Map::Item texture_map : mtl_mat_.texture_maps.items()) { - if (texture_map.value.image_path.empty()) { + if (!texture_map.value.is_valid()) { /* No Image texture node of this map type can be added to this material. */ continue; } -- cgit v1.2.3