diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-22 15:25:03 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-22 15:25:03 -0500 |
commit | 88659e9fe793a02fb4edcbf8ef07307c25119604 (patch) | |
tree | 101a4f72c45ce3bce4bde6b3a391d32e69ccf70a /indra/newview | |
parent | 7135934e50bf2727c2366687af7427d44483e984 (diff) |
SL-18105 When saving an object's material to inventory, save the version that as overrides applied.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llgltfmateriallist.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llmaterialeditor.h | 3 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 3 |
6 files changed, 23 insertions, 6 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 88923ba734..4861c2a33b 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -74,6 +74,7 @@ namespace } LLViewerObject * obj = gObjectList.findObject(message["object_id"].asUUID()); + llassert(obj); // should never get an override for an object we don't know about S32 side = message["side"].asInteger(); std::string gltf_json = message["gltf_json"].asString(); diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 038f4df863..8086bcf402 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1401,7 +1401,7 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind } } -void LLMaterialEditor::loadLiveMaterialEditor() +void LLMaterialEditor::loadLive() { LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD(LIVE_MATERIAL_EDITOR_KEY)); if (me->setFromSelection()) @@ -1416,6 +1416,18 @@ void LLMaterialEditor::loadLiveMaterialEditor() } } +void LLMaterialEditor::loadObjectSave() +{ + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD(LIVE_MATERIAL_EDITOR_KEY)); + if (me->setFromSelection()) + { + me->mIsOverride = false; + me->childSetVisible("save", false); + me->openFloater(); + me->setFocus(TRUE); + } +} + void LLMaterialEditor::loadFromGLTFMaterial(LLUUID &asset_id) { if (asset_id.isNull()) diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 9cd8bcd88b..23cb32aacf 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -103,7 +103,8 @@ public: // will promt to select specific one static void loadMaterialFromFile(const std::string& filename, S32 index = -1); - static void loadLiveMaterialEditor(); + static void loadLive(); + static void loadObjectSave(); static void loadFromGLTFMaterial(LLUUID &asset_id); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f8e786fc97..c6e0bc5153 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4588,7 +4588,7 @@ void LLPanelFace::onPbrStartEditing() LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - LLMaterialEditor::loadLiveMaterialEditor(); + LLMaterialEditor::loadLive(); } bool LLPanelFace::isIdenticalPlanarTexgen() diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 47b355e554..18d215f9f4 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2970,7 +2970,7 @@ void load_life_gltf_material(bool copy) } else { - LLMaterialEditor::loadLiveMaterialEditor(); + LLMaterialEditor::loadLive(); } LLViewerJoystick::getInstance()->moveObjects(true); @@ -2980,12 +2980,12 @@ void load_life_gltf_material(bool copy) void handle_object_edit_gltf_material() { handle_object_edit(); - LLMaterialEditor::loadLiveMaterialEditor(); + LLMaterialEditor::loadLive(); } void handle_object_save_gltf_material() { - load_life_gltf_material(true); + LLMaterialEditor::loadObjectSave(); } void handle_attachment_edit(const LLUUID& inv_item_id) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index eaf0287dae..603dcc4fa7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5333,6 +5333,9 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma tep->setGLTFMaterialOverride(override_mat); + // if override mat exists, we must also have a source mat + llassert(override_mat ? src_mat : true); + if (override_mat && src_mat) { LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat); |