summaryrefslogtreecommitdiff
path: root/indra/newview/lllocalgltfmaterials.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-03-07 09:38:43 -0600
committerDave Parks <davep@lindenlab.com>2023-03-07 09:38:43 -0600
commitb9b913a60ada97fc61bf2176e443dc72c8359ccb (patch)
treea86a2a13727afb81f1eac41d78e0e169d0bdd269 /indra/newview/lllocalgltfmaterials.cpp
parent56e5385bd25cc50ea0055f5703dc3c24a5acfc93 (diff)
SL-19349 Fix for hang on bulk upload of materials, add bulk upload option to material selector, incidental decruft.
Diffstat (limited to 'indra/newview/lllocalgltfmaterials.cpp')
-rw-r--r--indra/newview/lllocalgltfmaterials.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp
index a9099b1ce9..996b168262 100644
--- a/indra/newview/lllocalgltfmaterials.cpp
+++ b/indra/newview/lllocalgltfmaterials.cpp
@@ -214,12 +214,18 @@ bool LLLocalGLTFMaterial::loadMaterial()
LLStringUtil::toLower(filename_lc);
std::string material_name;
- // Might be a good idea to make these textures into local textures
- decode_successful = LLTinyGLTFHelper::getMaterialFromFile(
- mFilename,
- mMaterialIndex,
- this,
- material_name);
+ tinygltf::Model model;
+ decode_successful = LLTinyGLTFHelper::loadModel(mFilename, model);
+ if (decode_successful)
+ {
+ // Might be a good idea to make these textures into local textures
+ decode_successful = LLTinyGLTFHelper::getMaterialFromModel(
+ mFilename,
+ model,
+ mMaterialIndex,
+ this,
+ material_name);
+ }
if (!material_name.empty())
{
@@ -308,7 +314,10 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::vector<std::string>& filenames)
S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename)
{
- S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename);
+ tinygltf::Model model;
+ LLTinyGLTFHelper::loadModel(filename, model);
+
+ S32 materials_in_file = model.materials.size();
if (materials_in_file <= 0)
{
return 0;