From 8f47657d646c06dbba8d44497c0f81fd00730cc8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 26 Oct 2022 16:08:28 -0500 Subject: SL-18443 Allow nulling out of override data and implement new override message protocol. --- indra/llprimitive/lltextureentry.cpp | 14 +++++++++++++- indra/llprimitive/lltextureentry.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive') 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 -- cgit v1.2.3