summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 58894dbd69..86efdfcd06 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1401,15 +1401,14 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
}
}
-void LLMaterialEditor::loadLiveMaterial(LLUUID &asset_id)
+void LLMaterialEditor::loadLiveMaterialEditor()
{
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD(LIVE_MATERIAL_EDITOR_KEY));
+ me->mIsOverride = true;
me->setTitle(me->getString("material_override_title"));
- me->setAssetId(asset_id);
- if (asset_id.notNull())
- {
- me->setFromGLTFMaterial(gGLTFMaterialList.getMaterial(asset_id));
- }
+ me->childSetVisible("save", false);
+ me->childSetVisible("save_as", false);
+ me->setFromSelection();
me->openFloater();
me->setFocus(TRUE);
}
@@ -1904,7 +1903,7 @@ private:
void LLMaterialEditor::applyToSelection()
{
- if (!mKey.isUUID() || mKey.asUUID() != LIVE_MATERIAL_EDITOR_KEY)
+ if (!mIsOverride)
{
// Only apply if working with 'live' materials
// Might need a better way to distinguish 'live' mode.
@@ -1974,6 +1973,22 @@ void LLMaterialEditor::setFromGLTFMaterial(LLGLTFMaterial* mat)
setAlphaCutoff(mat->mAlphaCutoff);
}
+void LLMaterialEditor::setFromSelection()
+{
+ struct LLSelectedTEGetGLTFRenderMaterial : public LLSelectedTEGetFunctor<LLPointer<LLGLTFMaterial> >
+ {
+ LLPointer<LLGLTFMaterial> get(LLViewerObject* object, S32 te_index)
+ {
+ return object->getTE(te_index)->getGLTFRenderMaterial(); // present user with combined override + asset
+ }
+ } func;
+
+ LLPointer<LLGLTFMaterial> mat;
+ LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat);
+ setFromGLTFMaterial(mat);
+}
+
+
void LLMaterialEditor::loadAsset()
{
// derived from LLPreviewNotecard::loadAsset