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/exporter/obj_export_mtl.hh
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/exporter/obj_export_mtl.hh')
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh26
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
index 80e3127f69f..f83b3b49bf5 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
@@ -8,8 +8,6 @@
#include "BLI_map.hh"
#include "BLI_math_vec_types.hh"
-#include "BLI_string_ref.hh"
-#include "BLI_vector.hh"
#include "DNA_node_types.h"
#include "obj_export_io.hh"
@@ -25,19 +23,22 @@ template<> struct DefaultHash<io::obj::eMTLSyntaxElement> {
} // namespace blender
namespace blender::io::obj {
-class OBJMesh;
/**
* Generic container for texture node properties.
*/
struct tex_map_XX {
tex_map_XX(StringRef to_socket_id) : dest_socket_id(to_socket_id){};
+ bool is_valid() const
+ {
+ return !image_path.empty();
+ }
- /** Target socket which this texture node connects to. */
+ /* Target socket which this texture node connects to. */
const std::string dest_socket_id;
float3 translation{0.0f};
float3 scale{1.0f};
- /* Only Flat and Smooth projections are supported. */
+ /* Only Flat and Sphere projections are supported. */
int projection_type = SHD_PROJ_FLAT;
std::string image_path;
std::string mtl_dir_path;
@@ -58,16 +59,15 @@ struct MTLMaterial {
texture_maps.add(eMTLSyntaxElement::map_Bump, tex_map_XX("Normal"));
}
- /**
- * Caller must ensure that the given lookup key exists in the Map.
- * \return Texture map corresponding to the given ID.
- */
+ const tex_map_XX &tex_map_of_type(const eMTLSyntaxElement key) const
+ {
+ BLI_assert(texture_maps.contains(key));
+ return texture_maps.lookup(key);
+ }
tex_map_XX &tex_map_of_type(const eMTLSyntaxElement key)
{
- {
- BLI_assert(texture_maps.contains_as(key));
- return texture_maps.lookup_as(key);
- }
+ BLI_assert(texture_maps.contains(key));
+ return texture_maps.lookup(key);
}
std::string name;