Skip to content

Commit

Permalink
viewer-private#398 Fix constant asset rerequests
Browse files Browse the repository at this point in the history
  • Loading branch information
akleshchev committed Feb 21, 2025
1 parent 941c002 commit c99fdb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions indra/newview/gltfscenemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,9 @@ void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)
llassert(obj->getVolume()->getParams().getSculptID() == gltf_id);
llassert(obj->getVolume()->getParams().getSculptType() == LL_SCULPT_TYPE_GLTF);

if (obj->mGLTFAsset)
{ // object already has a GLTF asset, don't reload it
if (obj->mGLTFAsset || obj->mIsGLTFAssetMissing )
{
// object already has a GLTF asset or load failed, don't reload it

// TODO: below assertion fails on dupliate requests for assets -- possibly need to touch up asset loading state machine
// llassert(std::find(mObjects.begin(), mObjects.end(), obj) != mObjects.end());
Expand Down Expand Up @@ -398,16 +399,19 @@ void GLTFSceneManager::onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::ETyp
}
else
{
LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL;
LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->mGLTFAsset = nullptr;
}
}
}
obj->unref(); // todo: use LLPointer
}
}
else
{
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->unref();
}
});
Expand Down Expand Up @@ -446,7 +450,8 @@ void GLTFSceneManager::onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType a
}
else
{
LL_WARNS("GLTF") << "Buffer URI is not a valid UUID: " << buffer.mUri << LL_ENDL;
LL_WARNS("GLTF") << "Buffer URI is not a valid UUID: " << buffer.mUri << " for asset id: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->unref();
return;
}
Expand All @@ -455,7 +460,8 @@ void GLTFSceneManager::onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType a
}
else
{
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->unref();
}
}
Expand Down Expand Up @@ -517,6 +523,7 @@ void GLTFSceneManager::update()
if (mUploadingObject)
{
mUploadingObject->mGLTFAsset = nullptr;
mUploadingObject->mIsGLTFAssetMissing = false;
mUploadingObject->setGLTFAsset(assetId);
mUploadingObject->markForUpdate();
mUploadingObject = nullptr;
Expand Down
1 change: 1 addition & 0 deletions indra/newview/llviewerobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ class LLViewerObject

// Associated GLTF Asset
std::shared_ptr<LL::GLTF::Asset> mGLTFAsset;
bool mIsGLTFAssetMissing = false;

// Pipeline classes
LLPointer<LLDrawable> mDrawable;
Expand Down

0 comments on commit c99fdb3

Please sign in to comment.