diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-03-31 13:38:59 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-04-01 14:59:19 +0300 |
commit | d120a083da1f4bbead4895209dd064d1455bc7d6 (patch) | |
tree | 7f45fcb54b7c607048a5b6dadff665a9012c82ee /source/blender/io/wavefront_obj/exporter/obj_export_io.hh | |
parent | b073f58a8e96ab3224c67550672a051e61a718e8 (diff) |
Fix T96763: New OBJ Exporter Incorrectly saving the materials in the MTL file
Original report (T96763) only reported the issue of double-space before the texture path, but while adding test coverage I found some other issues that I fixed while at it:
- Incorrectly emits two spaces between `map_Xx` keyword and the texture path, leading to some 3rd party software not finding the textures,
- Emissive texture map (`map_Ke`) was not exported,
- When Mapping node is used on the texture UVs, the "Location" and "Scale" values were mixed up (location written as "scale", scale written as "location).
Added gtest coverage.
Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14519
Diffstat (limited to 'source/blender/io/wavefront_obj/exporter/obj_export_io.hh')
-rw-r--r-- | source/blender/io/wavefront_obj/exporter/obj_export_io.hh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_io.hh b/source/blender/io/wavefront_obj/exporter/obj_export_io.hh index 0095384609a..0d7c089ec14 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_io.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_io.hh @@ -236,27 +236,27 @@ constexpr FormattingSyntax syntax_elem_to_formatting(const eMTLSyntaxElement key case eMTLSyntaxElement::Ke: { return {"Ke {:.6f} {:.6f} {:.6f}\n", 3, is_type_float<T...>}; } - /* Keep only one space between options since filepaths may have leading spaces too. */ + /* Note: first texture map related argument, if present, will have its own leading space. */ case eMTLSyntaxElement::map_Kd: { - return {"map_Kd {} {}\n", 2, is_type_string_related<T...>}; + return {"map_Kd{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::map_Ks: { - return {"map_Ks {} {}\n", 2, is_type_string_related<T...>}; + return {"map_Ks{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::map_Ns: { - return {"map_Ns {} {}\n", 2, is_type_string_related<T...>}; + return {"map_Ns{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::map_d: { - return {"map_d {} {}\n", 2, is_type_string_related<T...>}; + return {"map_d{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::map_refl: { - return {"map_refl {} {}\n", 2, is_type_string_related<T...>}; + return {"map_refl{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::map_Ke: { - return {"map_Ke {} {}\n", 2, is_type_string_related<T...>}; + return {"map_Ke{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::map_Bump: { - return {"map_Bump {} {}\n", 2, is_type_string_related<T...>}; + return {"map_Bump{} {}\n", 2, is_type_string_related<T...>}; } case eMTLSyntaxElement::string: { return {"{}", 1, is_type_string_related<T...>}; |