Selaa lähdekoodia

Search for .gltf extension at end of file name for buffer prefix.

Previously the code assumed that there would be only one '.' in the file
name, which is not a valid assumption. This patch fixes this issue, but
still assumes that the only occurrence of the string ".gltf" is at the
end of the file name. In particular, it will fail on a file name like
"/path/to/a.gltf/my_gltf.wrong_extension".
John Senneker 8 vuotta sitten
vanhempi
commit
d6e8fd34f0
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      code/glTFExporter.cpp

+ 1 - 1
code/glTFExporter.cpp

@@ -511,7 +511,7 @@ void glTFExporter::ExportMeshes()
     // Variables needed for compression. END.
 
     std::string fname = std::string(mFilename);
-    std::string bufferIdPrefix = fname.substr(0, fname.find("."));
+    std::string bufferIdPrefix = fname.substr(0, fname.rfind(".gltf"));
     std::string bufferId = mAsset->FindUniqueID("", bufferIdPrefix.c_str());
 
     Ref<Buffer> b = mAsset->GetBodyBuffer();