From 33b4df56e722db3460792ab1fba48a467dfde213 Mon Sep 17 00:00:00 2001 From: Hecklezz Date: Sun, 8 Feb 2026 19:13:07 +1000 Subject: [PATCH] Fix undefined behaviour in FS PBR Texture Panel sometimes breaking the material picker --- indra/newview/fspanelface.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/indra/newview/fspanelface.cpp b/indra/newview/fspanelface.cpp index 0a16503229..05b50100b6 100644 --- a/indra/newview/fspanelface.cpp +++ b/indra/newview/fspanelface.cpp @@ -472,9 +472,18 @@ struct LLSelectedTEGetmatId : public LLSelectedTEFunctor LLSelectedTEGetmatId() : mHasFacesWithoutPBR(false), mHasFacesWithPBR(false), + mIdenticalMaterial(true), + mIdenticalBaseColor(true), + mIdenticalMetallic(true), + mIdenticalRoughness(true), + mIdenticalEmissive(true), + mIdenticalDoubleSided(true), + mIdenticalAlphaMode(true), + mIdenticalAlphaCutoff(true), mInitialized(false), mMaterial(nullptr) { + mIdenticalMap.fill(true); } bool apply(LLViewerObject* object, S32 te_index) override @@ -567,17 +576,6 @@ struct LLSelectedTEGetmatId : public LLSelectedTEFunctor } else { - LL_DEBUGS("GET_GLTF_MATERIAL_PARAMS") << 10000012 << LL_ENDL; - - mIdenticalMaterial = true; - mIdenticalBaseColor = true; - mIdenticalMetallic = true; - mIdenticalRoughness = true; - mIdenticalEmissive = true; - mIdenticalDoubleSided = true; - mIdenticalAlphaMode = true; - mIdenticalAlphaCutoff = true; - LL_DEBUGS("GET_GLTF_MATERIAL_PARAMS") << 10000013 << LL_ENDL; LLGLTFMaterial* mat = object->getTE(te_index)->getGLTFMaterial(); @@ -596,9 +594,6 @@ struct LLSelectedTEGetmatId : public LLSelectedTEFunctor for(U32 map = 0; map < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; map++) { - // initialize array to say "all PBR maps are the same" - mIdenticalMap[map] = true; - LL_DEBUGS("GET_GLTF_MATERIAL_PARAMS") << 10000017 << " map:" << map << LL_ENDL; if (override && override->mTextureId[map].notNull()) @@ -643,7 +638,7 @@ struct LLSelectedTEGetmatId : public LLSelectedTEFunctor bool mIdenticalMaterial; - bool mIdenticalMap[LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT]; + std::array mIdenticalMap; bool mIdenticalBaseColor; bool mIdenticalMetallic; bool mIdenticalRoughness;