diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-12-09 16:34:28 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2022-12-09 16:34:28 -0500 |
commit | f41278082f2ab204ec60c15ee1530ca4440937a5 (patch) | |
tree | c382bb0e6cde299e853d09b19a47f1d82dc537fa /indra/newview/lllocalgltfmaterials.cpp | |
parent | fc424a0db90fd2d2e44e85a19750ad6eaa57b28a (diff) | |
parent | e3b34fec6962e6deda3dd9dd83bf9fa20ab594af (diff) |
SL-18809: Merge 'DRTVWR-559' of secondlife/viewer into sl-18809
Diffstat (limited to 'indra/newview/lllocalgltfmaterials.cpp')
-rw-r--r-- | indra/newview/lllocalgltfmaterials.cpp | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index 89f14c6cfa..a9099b1ce9 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -308,48 +308,10 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::vector<std::string>& filenames) S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) { - std::string exten = gDirUtilp->getExtension(filename); - S32 materials_in_file = 0; - - if (exten == "gltf" || exten == "glb") + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + if (materials_in_file <= 0) { - tinygltf::TinyGLTF loader; - std::string error_msg; - std::string warn_msg; - - tinygltf::Model model_in; - - std::string filename_lc = filename; - LLStringUtil::toLower(filename_lc); - - // 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. - bool decode_successful = false; - if (std::string::npos == filename_lc.rfind(".gltf")) - { // file is binary - decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc); - } - else - { // file is ascii - decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc); - } - - if (!decode_successful) - { - LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg - << ", warning:" << warn_msg - << " file: " << filename - << LL_ENDL; - return 0; - } - - if (model_in.materials.empty()) - { - // materials are missing - LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL; - return 0; - } - materials_in_file = model_in.materials.size(); + return 0; } S32 loaded_materials = 0; |