diff options
| author | Dave Parks <davep@lindenlab.com> | 2022-10-21 18:05:19 -0500 |
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2022-10-21 18:05:19 -0500 |
| commit | 0cd7c3842119f1801872b4db05e17544b4eb7158 (patch) | |
| tree | a79c8ec7c24be3263c05bf0758da758a4518924b /indra/newview/llmaterialeditor.cpp | |
| parent | 61967623baaa8988f4f8b48043f79be29452ca80 (diff) | |
SL-18105 Hook up live material editor to current selection set and implicitly open build floater when editing a PBR material.
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
| -rw-r--r-- | indra/newview/llmaterialeditor.cpp | 29 |
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 |
