summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-09-21 14:54:22 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-09-21 14:54:22 -0500
commit360ffff2885bff2f816c099dc414dc126cb7e258 (patch)
tree984f8e9680786dd96c737eacfcb67a1c1dac9008 /indra
parente02dc20b9db4c6ec192b2c68c4c732a26296fc20 (diff)
SL-20321 Interpret missing TEs in override messages as indication overrides should be nulled out if present.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llgltfmateriallist.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 0bdfcf05e7..a92e699c42 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -357,6 +357,9 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
const LLSD& tes = data["te"];
const LLSD& od = data["od"];
+ constexpr U32 MAX_TES = 45;
+ bool has_te[MAX_TES] = { false };
+
if (tes.isArray())
{
LLGLTFOverrideCacheEntry cache;
@@ -364,13 +367,15 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
cache.mObjectId = id;
cache.mRegionHandle = region->getHandle();
- for (int i = 0; i < tes.size(); ++i)
+ U32 count = llmin(tes.size(), MAX_TES);
+ for (U32 i = 0; i < count; ++i)
{
LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership
mat->applyOverrideLLSD(od[i]);
S32 te = tes[i].asInteger();
+ has_te[te] = true;
cache.mSides[te] = od[i];
cache.mGLTFMaterial[te] = mat;
@@ -384,6 +389,20 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
}
}
+ if (obj)
+ { // null out overrides on TEs that shouldn't have them
+ U32 count = llmin(obj->getNumTEs(), MAX_TES);
+ for (U32 i = 0; i < count; ++i)
+ {
+ LLTextureEntry* te = obj->getTE(i);
+ if (te && te->getGLTFMaterialOverride())
+ {
+ obj->setTEGLTFMaterialOverride(i, nullptr);
+ handle_gltf_override_message.doSelectionCallbacks(id, i);
+ }
+ }
+ }
+
region->cacheFullUpdateGLTFOverride(cache);
}