diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-06-20 15:05:14 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-06-20 23:23:05 +0300 |
commit | 2515f422cfea1d2ad6947022636c1e3a70f4b282 (patch) | |
tree | 2d8bf2da091aa66ef9a30243e643cdc7cb012523 /indra/newview | |
parent | 5c9d985b92ce059044cb15a0bdafa84dd3bd777f (diff) |
viewer-private#247 Retry loading missing textures for model upload
in case user provided a texture later, after seeing a 'missing texture'
error.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmeshrepository.h | 2 | ||||
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index b9430a6165..b850ade0bb 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -533,7 +533,7 @@ public: // Inherited from LLCore::HttpHandler virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); - LLViewerFetchedTexture* FindViewerTexture(const LLImportMaterial& material); + static LLViewerFetchedTexture* FindViewerTexture(const LLImportMaterial& material); private: LLHandle<LLWholeModelFeeObserver> mFeeObserverHandle; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 7ecd7cdff9..b1a48db0ee 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -543,6 +543,32 @@ void LLModelPreview::rebuildUploadData() } instance.mTransform = mat; mUploadData.push_back(instance); + + // if uploading textures, make sure textures are present + if (mFMP->childGetValue("upload_textures").asBoolean()) // too early to cheack if still loading + { + for (auto& mat_pair : instance.mMaterial) + { + LLImportMaterial& material = mat_pair.second; + + if (material.mDiffuseMapFilename.size()) + { + LLViewerFetchedTexture* texture = LLMeshUploadThread::FindViewerTexture(material); + if (texture && texture->isMissingAsset()) + { + // in case user provided a missing file later + texture->setIsMissingAsset(false); + texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, NULL, false); + texture->forceToSaveRawImage(0, F32_MAX); + texture->updateFetch(); + if (mModelLoader) + { + mModelLoader->mNumOfFetchingTextures++; + } + } + } + } + } } } |