Skip to content
Snippets Groups Projects
Commit 7c211114 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix loading local GLTF materials on case sensitive file systems

parent 25f82bb8
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -194,26 +194,23 @@ bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& m ...@@ -194,26 +194,23 @@ bool LLTinyGLTFHelper::loadModel(const std::string& filename, tinygltf::Model& m
std::string error_msg; std::string error_msg;
std::string warn_msg; std::string warn_msg;
std::string filename_lc = filename;
LLStringUtil::toLower(filename_lc);
// Load a tinygltf model fom a file. Assumes that the input filename has already been // Load a tinygltf model fom a file. Assumes that the input filename has already been
// been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish.
bool decode_successful = false; bool decode_successful = false;
if (std::string::npos == filename_lc.rfind(".gltf")) if (exten == "glb")
{ // file is binary { // file is binary
decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc); decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename);
} }
else else
{ // file is ascii { // file is ascii
decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc); decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename);
} }
if (!decode_successful) if (!decode_successful)
{ {
LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg LL_WARNS("GLTF") << "Cannot load, error: Failed to decode with error: '" << error_msg
<< ", warning:" << warn_msg << "', warning: '" << warn_msg
<< " file: " << filename << "' file: " << filename
<< LL_ENDL; << LL_ENDL;
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment