summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-10-26 16:08:28 -0500
committerDave Parks <davep@lindenlab.com>2022-10-26 16:08:28 -0500
commit8f47657d646c06dbba8d44497c0f81fd00730cc8 (patch)
treeeec5702e7dc4d83a8bf00c0c7a87272870fcec42 /indra/llprimitive
parented1e5214cefc5f0aeb630bf2fbcda9dff9ed8d61 (diff)
SL-18443 Allow nulling out of override data and implement new override message protocol.
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lltextureentry.cpp14
-rw-r--r--indra/llprimitive/lltextureentry.h2
2 files changed, 14 insertions, 2 deletions
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp
index d810c6ed25..7640dd70bd 100644
--- a/indra/llprimitive/lltextureentry.cpp
+++ b/indra/llprimitive/lltextureentry.cpp
@@ -512,13 +512,25 @@ S32 LLTextureEntry::setBumpShiny(U8 bump_shiny)
void LLTextureEntry::setGLTFMaterial(LLGLTFMaterial* material)
{
- mGLTFMaterial = material;
+ // assert on precondtion:
+ // whether or not mGLTFMaterial is null, any existing override should have been nulled out
+ // before calling setGLTFMaterial
+ // NOTE: if you're hitting this assert, try to make sure calling code is using LLViewerObject::setRenderMaterialID
+ llassert(getGLTFMaterialOverride() == nullptr);
+
+ mGLTFMaterial = material;
if (mGLTFMaterial == nullptr)
{
setGLTFRenderMaterial(nullptr);
}
}
+void LLTextureEntry::setGLTFMaterialOverride(LLGLTFMaterial* mat)
+{
+ llassert(mat == nullptr || getGLTFMaterial() != nullptr); // if override is not null, base material must not be null
+ mGLTFMaterialOverrides = mat;
+}
+
LLGLTFMaterial* LLTextureEntry::getGLTFRenderMaterial() const
{
if (mGLTFRenderMaterial.notNull())
diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h
index e37bc9a3b6..d94e14bd73 100644
--- a/indra/llprimitive/lltextureentry.h
+++ b/indra/llprimitive/lltextureentry.h
@@ -200,7 +200,7 @@ public:
// GLTF override
LLGLTFMaterial* getGLTFMaterialOverride() const { return mGLTFMaterialOverrides; }
- void setGLTFMaterialOverride(LLGLTFMaterial* mat) { mGLTFMaterialOverrides = mat; }
+ void setGLTFMaterialOverride(LLGLTFMaterial* mat);
// GLTF render material
// nuanced behavior here -- if there is no render material, fall back to getGLTFMaterial, but ONLY for the getter, not the setter