From c3974512e4826b6ee453504cfaccc73b550b8b91 Mon Sep 17 00:00:00 2001 From: Andrej Date: Tue, 16 May 2017 15:55:40 +0200 Subject: [PATCH] Improved obj exporter to export materials to fileName.mtl instead of fileName.obj.mtl --- code/ObjExporter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/ObjExporter.cpp b/code/ObjExporter.cpp index 564de1c12..c1a667744 100644 --- a/code/ObjExporter.cpp +++ b/code/ObjExporter.cpp @@ -124,6 +124,11 @@ std::string ObjExporter :: GetMaterialLibName() // ------------------------------------------------------------------------------------------------ std::string ObjExporter :: GetMaterialLibFileName() { + // Remove existing .obj file extention so that the final material file name will be fileName.mtl and not fileName.obj.mtl + size_t lastdot = filename.find_last_of("."); + if (lastdot != std::string::npos) + filename = filename.substr(0, lastdot); + return filename + MaterialExt; }