diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfetchedgltfmaterial.h | 2 | ||||
-rw-r--r-- | indra/newview/llgltfmateriallist.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 6 |
3 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index 96f7fbea8e..0b51770493 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -46,6 +46,8 @@ public: // media_tex - optional media texture that may override the base color texture void bind(LLViewerTexture* media_tex = nullptr); + bool isFetching() const { return mFetching; } + // Textures used for fetching/rendering LLPointer<LLViewerFetchedTexture> mBaseColorTexture; LLPointer<LLViewerFetchedTexture> mNormalTexture; diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 4051521ad4..d0c1c73f0e 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -157,8 +157,8 @@ public: // receive override data from simulator via LargeGenericMessage // message should have: // object_id - UUID of LLViewerObject - // side - S32 index of texture entry - // gltf_json - String of GLTF json for override data + // sides - array of S32 indices of texture entries + // gltf_json - array of corresponding Strings of GLTF json for override data LLSD message; @@ -380,11 +380,22 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) { // object doesn't have its base GLTF material yet, don't apply override (yet) return; } - obj->setTEGLTFMaterialOverride(i, overrides[i]); + + S32 status = obj->setTEGLTFMaterialOverride(i, overrides[i]); + if (status == TEM_CHANGE_NONE) + { + // 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 + return; + } + if (obj->getTE(i)->isSelected()) { handle_gltf_override_message.doSelectionCallbacks(id, i); } + // success! + overrides[i] = nullptr; } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fd3c8de3e9..cb1694821d 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5375,6 +5375,12 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma return retval; } + if(src_mat->isFetching()) + { + // if still fetching, we need to wait until it is done and try again + return retval; + } + tep->setGLTFMaterialOverride(override_mat); // if override mat exists, we must also have a source mat |