From 5ee774f4ecda6ab312239b0d2ab1d7849ff535b0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 26 Oct 2022 22:40:16 +0300 Subject: SL-18446 Support "multiple textures" in Live material overrides --- indra/newview/llmaterialeditor.cpp | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 58804a901f..a6d2729dfa 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -334,6 +334,7 @@ void LLMaterialEditor::setBaseColorId(const LLUUID& id) { mBaseColorTextureCtrl->setValue(id); mBaseColorTextureCtrl->setDefaultImageAssetID(id); + mBaseColorTextureCtrl->setTentative(FALSE); } void LLMaterialEditor::setBaseColorUploadId(const LLUUID& id) @@ -409,6 +410,7 @@ void LLMaterialEditor::setMetallicRoughnessId(const LLUUID& id) { mMetallicTextureCtrl->setValue(id); mMetallicTextureCtrl->setDefaultImageAssetID(id); + mMetallicTextureCtrl->setTentative(FALSE); } void LLMaterialEditor::setMetallicRoughnessUploadId(const LLUUID& id) @@ -452,6 +454,7 @@ void LLMaterialEditor::setEmissiveId(const LLUUID& id) { mEmissiveTextureCtrl->setValue(id); mEmissiveTextureCtrl->setDefaultImageAssetID(id); + mEmissiveTextureCtrl->setTentative(FALSE); } void LLMaterialEditor::setEmissiveUploadId(const LLUUID& id) @@ -485,6 +488,7 @@ void LLMaterialEditor::setNormalId(const LLUUID& id) { mNormalTextureCtrl->setValue(id); mNormalTextureCtrl->setDefaultImageAssetID(id); + mNormalTextureCtrl->setTentative(FALSE); } void LLMaterialEditor::setNormalUploadId(const LLUUID& id) @@ -2188,25 +2192,40 @@ bool LLMaterialEditor::setFromSelection() { struct LLSelectedTEGetGLTFRenderMaterial : public LLSelectedTEGetFunctor > { - LLPointer get(LLViewerObject* object, S32 te_index) + LLPointer get(LLViewerObject* objectp, S32 te_index) { - return object->getTE(te_index)->getGLTFRenderMaterial(); // present user with combined override + asset + if (!objectp) + { + return nullptr; + } + LLTextureEntry *tep = objectp->getTE(te_index); + if (!tep) + { + return nullptr; + } + return tep->getGLTFRenderMaterial(); // present user with combined override + asset } } func; LLPointer mat; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat); + bool identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat); if (mat.notNull()) { setFromGLTFMaterial(mat); - return true; + } + else + { + // pick defaults from a blank material; + LLGLTFMaterial blank_mat; + setFromGLTFMaterial(&blank_mat); } - // pick defaults from a blank material; - LLGLTFMaterial blank_mat; - setFromGLTFMaterial(&blank_mat); + mBaseColorTextureCtrl->setTentative(!identical); + mMetallicTextureCtrl->setTentative(!identical); + mEmissiveTextureCtrl->setTentative(!identical); + mNormalTextureCtrl->setTentative(!identical); - return false; + return mat.notNull(); } -- cgit v1.2.3