From 4aaa48419594c993c6c1b0bd2f5585c6492b6a31 Mon Sep 17 00:00:00 2001 From: Sabrina Shanman Date: Wed, 9 Nov 2022 00:16:41 +0000 Subject: Revert "SL-18523: When editing an object's material override, use the object's material override as a base, rather than its render material (pull request #1190)" --- indra/llprimitive/llgltfmaterial.cpp | 26 -------------------------- indra/llprimitive/llgltfmaterial.h | 3 --- indra/newview/llmaterialeditor.cpp | 15 ++++----------- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index ee1931a27b..6d23cb8039 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -61,29 +61,6 @@ LLMatrix3 LLGLTFMaterial::TextureTransform::asMatrix() return offset * rotation * scale; } -LLGLTFMaterial::LLGLTFMaterial(bool for_override) -: LLGLTFMaterial() -{ - if (for_override) - { - setBaseColorId(mBaseColorId, for_override); - setNormalId(mNormalId, for_override); - setMetallicRoughnessId(mMetallicRoughnessId, for_override); - setEmissiveId(mEmissiveId, for_override); - - setBaseColorFactor(mBaseColor, for_override); - setAlphaCutoff(mAlphaCutoff, for_override); - setEmissiveColorFactor(mEmissiveColor, for_override); - setMetallicFactor(mMetallicFactor, for_override); - setRoughnessFactor(mRoughnessFactor, for_override); - setAlphaMode(mAlphaMode, for_override); - setDoubleSided(mDoubleSided, for_override); - - // *NOTE: Texture offsets only exist in overrides, so there is no need - // to hack in the override value here. - } -} - LLGLTFMaterial::LLGLTFMaterial(const LLGLTFMaterial& rhs) { *this = rhs; @@ -611,9 +588,6 @@ void LLGLTFMaterial::applyOverrideUUID(LLUUID& dst_id, const LLUUID& override_id } } -// Make a static default material override for editing materials -const LLGLTFMaterial LLGLTFMaterial::sOverrideDefault{true}; - void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) { LL_PROFILE_ZONE_SCOPED; diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 2476818b27..60116fd423 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -48,8 +48,6 @@ public: // default material for reference static const LLGLTFMaterial sDefault; - // default material override for reference - static const LLGLTFMaterial sOverrideDefault; struct TextureTransform { @@ -68,7 +66,6 @@ public: }; LLGLTFMaterial() {} - LLGLTFMaterial(bool for_override); LLGLTFMaterial(const LLGLTFMaterial& rhs); LLGLTFMaterial& operator=(const LLGLTFMaterial& rhs); diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 70b165460a..a0cb4e1c8f 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2385,26 +2385,19 @@ public: // Selection can cover multiple objects, and live editor is // supposed to overwrite changed values only LLTextureEntry* tep = objectp->getTE(te); + LLPointer material = tep->getGLTFRenderMaterial(); - if (tep->getGLTFMaterial().isNull()) + if (material.isNull()) { // overrides are not supposed to work or apply if // there is no base material to work from return false; } - LLPointer material = tep->getGLTFMaterialOverride(); + // make a copy to not invalidate existing // material for multiple objects - if (material.isNull()) - { - // Start with a material override which does not make any changes - material = new LLGLTFMaterial(LLGLTFMaterial::sOverrideDefault); - } - else - { - material = new LLGLTFMaterial(*material); - } + material = new LLGLTFMaterial(*material); U32 changed_flags = mEditor->getUnsavedChangesFlags(); U32 reverted_flags = mEditor->getRevertedChangesFlags(); -- cgit v1.2.3