summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-26 22:40:16 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-26 22:40:30 +0300
commit5ee774f4ecda6ab312239b0d2ab1d7849ff535b0 (patch)
tree2b8fcde274aa53834c2f08a64ca897ed4d7131e9
parent1dad0f8eb863381536dfb5094d7dacc9b445d543 (diff)
SL-18446 Support "multiple textures" in Live material overrides
-rw-r--r--indra/newview/llmaterialeditor.cpp35
1 files changed, 27 insertions, 8 deletions
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<LLGLTFMaterial> >
{
- LLPointer<LLGLTFMaterial> get(LLViewerObject* object, S32 te_index)
+ LLPointer<LLGLTFMaterial> 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<LLGLTFMaterial> 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();
}