diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2023-01-24 17:48:18 -0800 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2023-01-25 12:34:35 -0800 |
commit | 2aaa15fef15243e6b38f46426d8ebb355ccfb807 (patch) | |
tree | 718f00f4f3c5eb412199ab1b4c530e3308a647c2 /indra/newview/llfetchedgltfmaterial.cpp | |
parent | a851aa83e705fa4a1c78919cfcac6709cfb1a875 (diff) |
SL-19012: Fix new material IDs sometimes not applying when set via LSL
Diffstat (limited to 'indra/newview/llfetchedgltfmaterial.cpp')
-rw-r--r-- | indra/newview/llfetchedgltfmaterial.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index b095b74519..047f1a4965 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -115,3 +115,35 @@ void LLFetchedGLTFMaterial::bind() } } + +void LLFetchedGLTFMaterial::materialBegin() +{ + llassert(!mFetching); + mFetching = true; +} + +void LLFetchedGLTFMaterial::onMaterialComplete(std::function<void()> material_complete) +{ + if (!material_complete) { return; } + + if (!mFetching) + { + material_complete(); + return; + } + + materialCompleteCallbacks.push_back(material_complete); +} + +void LLFetchedGLTFMaterial::materialComplete() +{ + llassert(mFetching); + mFetching = false; + + for (std::function<void()> material_complete : materialCompleteCallbacks) + { + material_complete(); + } + materialCompleteCallbacks.clear(); + materialCompleteCallbacks.shrink_to_fit(); +} |