From 2aaa15fef15243e6b38f46426d8ebb355ccfb807 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 24 Jan 2023 17:48:18 -0800 Subject: SL-19012: Fix new material IDs sometimes not applying when set via LSL --- indra/newview/llfetchedgltfmaterial.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'indra/newview/llfetchedgltfmaterial.cpp') 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 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 material_complete : materialCompleteCallbacks) + { + material_complete(); + } + materialCompleteCallbacks.clear(); + materialCompleteCallbacks.shrink_to_fit(); +} -- cgit v1.2.3