summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llgltfmateriallist.cpp11
-rw-r--r--indra/newview/llviewerobject.cpp13
2 files changed, 22 insertions, 2 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index d0c1c73f0e..678ec7e46b 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -376,8 +376,14 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
{
if (overrides[i].notNull())
{
- if (!obj->getTE(i) || !obj->getTE(i)->getGLTFMaterial())
- { // object doesn't have its base GLTF material yet, don't apply override (yet)
+ if (!obj->getTE(i))
+ { // object is incomplete
+ return;
+ }
+
+ if (!obj->getTE(i)->getGLTFMaterial())
+ {
+ // doesn't have its base GLTF material yet, don't apply override(yet)
return;
}
@@ -387,6 +393,7 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
// can't apply this yet, since failure to change the material override
// probably means the base material is still being fetched. leave in
// the queue for later
+ //obj->setDebugText("early out 3");
return;
}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index a3a825c199..cc7e716bb5 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4961,6 +4961,18 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
if (mat == nullptr && mat_id.notNull())
{
mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id);
+ if (mat->isFetching())
+ { // material is not loaded yet, rebuild draw info when the object finishes loading
+ LLUUID id = getID();
+ mat->onMaterialComplete([=]
+ {
+ LLViewerObject* obj = gObjectList.findObject(id);
+ if (obj)
+ {
+ obj->markForUpdate(FALSE);
+ }
+ });
+ }
getTE(te)->setGLTFMaterial(mat);
}
else if (mat_id.isNull() && mat != nullptr)
@@ -5391,6 +5403,7 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma
render_mat->applyOverride(*override_mat);
tep->setGLTFRenderMaterial(render_mat);
retval = TEM_CHANGE_TEXTURE;
+
}
else if (tep->setGLTFRenderMaterial(nullptr))
{