Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-08-11 15:51:36 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-08-11 15:51:36 +0300
commit0a096f2be233b6faca468a1add615fb72e57909e (patch)
treeca5591dba8f268173620910694dfd2278a4d3621 /source/blender/io/wavefront_obj/importer
parented55054e57a35278e90d7ecd512521289d450fd8 (diff)
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.
Diffstat (limited to 'source/blender/io/wavefront_obj/importer')
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_mtl.cc4
1 files changed, 2 insertions, 2 deletions
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<const eMTLSyntaxElement, tex_map_XX>::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;
}