diff options
| author | Dave Parks <davep@lindenlab.com> | 2023-03-23 13:33:21 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2023-03-23 13:33:21 -0500 | 
| commit | 81bccc05e296b80163bf28aea537e9ded2a0927e (patch) | |
| tree | 734f2ecac9521384efe828d6d2344ad4e7ceec50 /indra | |
| parent | af57bbf0ca70f0a6209a7e39261a806040f6ea92 (diff) | |
SL-18458 Fix for overrides not applying if material is not loaded on rebuild.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llgltfmateriallist.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 13 | 
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))      { | 
