Explorar o código

Merge pull request #1274 from ab4d/master

Improved obj exporter to export materials to fileName.mtl file instead of fileName.obj.mtl
Kim Kulling %!s(int64=8) %!d(string=hai) anos
pai
achega
2b785e4e81
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      code/ObjExporter.cpp

+ 5 - 0
code/ObjExporter.cpp

@@ -124,6 +124,11 @@ std::string ObjExporter :: GetMaterialLibName()
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 std::string ObjExporter :: GetMaterialLibFileName()
 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;
     return filename + MaterialExt;
 }
 }