From eec96559d41fd74a4fa1137336941a6c20036eba Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 2 Aug 2022 00:59:21 +0300 Subject: 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. --- indra/newview/llmaterialeditor.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'indra') 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); } -- cgit v1.2.3