From cbeb8770cc4daec5c81f8d8ce060a1b594c039bb Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Wed, 4 May 2022 15:10:54 +0300 Subject: 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 --- source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh') 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 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. -- cgit v1.2.3