diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-05-04 15:10:54 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-05-04 15:10:54 +0300 |
commit | cbeb8770cc4daec5c81f8d8ce060a1b594c039bb (patch) | |
tree | e25bc52bb3636f8573e819712768a51dfdf24df2 /source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh | |
parent | b31f5b8ce7ae0f3f8195dc04a2006945fe6b4bff (diff) |
Fix T97794: new OBJ importer does not handle quoted MTL paths
Fixes T97794 (which is a reintroduction of an older issue T67266 that
has been fixed in the python importer, but the fix was not in the C++
one). Some software produces OBJ files with mtllib statements like
mtllib "file name in quotes.mtl", and the new importer was not stripping
the quotes away.
While at it, I noticed that MTLParser constructor was taking a StringRef
and treating it as a zero-terminated string, which is not necessarily
the case. Fixed that by explicitly using a StringRefNull type.
Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14838
Diffstat (limited to 'source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh')
-rw-r--r-- | source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh index 8dd60d17100..e41a7f8518e 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh +++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh @@ -41,7 +41,7 @@ class OBJParser { Span<std::string> mtl_libraries() const; private: - void add_mtl_library(const std::string &path); + void add_mtl_library(StringRef path); void add_default_mtl_library(); }; @@ -57,7 +57,7 @@ class MTLParser { /** * Open material library file. */ - MTLParser(StringRef mtl_library_, StringRefNull obj_filepath); + MTLParser(StringRefNull mtl_library_, StringRefNull obj_filepath); /** * Read MTL file(s) and add MTLMaterial instances to the given Map reference. |