소스 검색

Improved obj exporter to export materials to fileName.mtl instead of fileName.obj.mtl

Andrej 8 년 전
부모
커밋
c3974512e4
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      code/ObjExporter.cpp

+ 5 - 0
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;
 }