diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-08-02 00:59:21 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-08-02 00:59:21 +0300 |
commit | eec96559d41fd74a4fa1137336941a6c20036eba (patch) | |
tree | 27ddd6f18859ccabb88e96bdfdcb1cafa978eb68 /indra | |
parent | 842ed39584b3df814c290931d750a1bf3b982cf3 (diff) |
SL-17653 Fix live material preview not working
Material was immediately dropped due to not having an id.
This is a placeholder untill build floater gets a proper way to select materials.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 47ae2ab4d1..57cd74e0f2 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1343,18 +1343,26 @@ void LLMaterialEditor::importMaterial() void LLMaterialEditor::applyToSelection() { - // Todo: associate with a specific 'selection' instead - // of modifying something that is selected - // This should be disabled when working from agent's - // inventory and for initial upload + // Todo: fix this, this is a hack, not a proper live preview LLViewerObject* objectp = LLSelectMgr::instance().getSelection()->getFirstObject(); - if (objectp && objectp->getVolume()) + if (objectp && objectp->getVolume() && objectp->permModify()) { LLGLTFMaterial* mat = new LLGLTFMaterial(); getGLTFMaterial(mat); LLVOVolume* vobjp = (LLVOVolume*)objectp; for (int i = 0; i < vobjp->getNumTEs(); ++i) { + // this is here just to prevent material from immediately resetting + if (mAssetID.notNull()) + { + vobjp->setRenderMaterialID(i, mAssetID); + } + else + { + const LLUUID placeholder("984e183e-7811-4b05-a502-d79c6f978a98"); + vobjp->setRenderMaterialID(i, placeholder); + } + vobjp->getTE(i)->setGLTFMaterial(mat); vobjp->updateTEMaterialTextures(i); } |