SL-18458 Fix for overrides not applying if material is not loaded on rebuild.
parent
af57bbf0ca
commit
81bccc05e2
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue