From 6b46793771a1d1db1601105604ac7bc82f8db7b3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 28 Sep 2022 20:01:06 +0300 Subject: SL-18233 Double clicking material in an object shows notecard --- indra/newview/llmaterialeditor.cpp | 19 +++++++++++++++---- indra/newview/llmaterialeditor.h | 4 +++- indra/newview/llpanelobjectinventory.cpp | 9 +++++---- 3 files changed, 23 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 4f51030fc0..1592235dba 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -180,6 +180,16 @@ LLMaterialEditor::LLMaterialEditor(const LLSD& key) } } +void LLMaterialEditor::setObjectID(const LLUUID& object_id) +{ + LLPreview::setObjectID(object_id); + const LLInventoryItem* item = getItem(); + if (item) + { + mAssetID = item->getAssetUUID(); + } +} + BOOL LLMaterialEditor::postBuild() { mBaseColorTextureCtrl = getChild("base_color_texture"); @@ -751,7 +761,8 @@ bool LLMaterialEditor::decodeAsset(const std::vector& buffer) if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), data.length(), "")) { - return setFromGltfModel(model_in, true); + // assets are only supposed to have one item + return setFromGltfModel(model_in, 0, true); } else { @@ -1878,8 +1889,8 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid, editor->decodeAsset(buffer); - BOOL allow_modify = editor->canModify(editor->mObjectID, editor->getItem()); - BOOL source_library = editor->mObjectID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); + BOOL allow_modify = editor->canModify(editor->mObjectUUID, editor->getItem()); + BOOL source_library = editor->mObjectUUID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); editor->setEnableEditing(allow_modify && !source_library); editor->setHasUnsavedChanges(false); editor->mAssetStatus = PREVIEW_ASSET_LOADED; @@ -2083,5 +2094,5 @@ void LLMaterialEditor::loadDefaults() { tinygltf::Model model_in; model_in.materials.resize(1); - setFromGltfModel(model_in, true); + setFromGltfModel(model_in, 0, true); } diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 7fd8e950a3..c6b976ea5a 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -143,6 +143,9 @@ public: void onClickCancel(); void onCancelMsgCallback(const LLSD& notification, const LLSD& response); + // llpreview + void setObjectID(const LLUUID& object_id) override; + // llpanel BOOL postBuild() override; void onClickCloseBtn(bool app_quitting = false) override; @@ -211,7 +214,6 @@ private: friend class LLMaterialFilePicker; LLUUID mAssetID; - LLUUID mObjectID; LLTextureCtrl* mBaseColorTextureCtrl; LLTextureCtrl* mMetallicTextureCtrl; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 2faa3a7137..c5bf18a065 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -50,6 +50,7 @@ #include "llinventoryicon.h" #include "llinventoryfilter.h" #include "llinventoryfunctions.h" +#include "llmaterialeditor.h" #include "llpreviewanim.h" #include "llpreviewgesture.h" #include "llpreviewnotecard.h" @@ -1197,17 +1198,17 @@ void LLTaskMaterialBridge::openItem() LLSD floater_key; floater_key["taskid"] = mPanel->getTaskUUID(); floater_key["itemid"] = mUUID; - LLPreviewNotecard* preview = LLFloaterReg::showTypedInstance("preview_notecard", floater_key, TAKE_FOCUS_YES); - if (preview) + LLMaterialEditor* mat = LLFloaterReg::showTypedInstance("material_editor", floater_key, TAKE_FOCUS_YES); + if (mat) { - preview->setObjectID(mPanel->getTaskUUID()); + mat->setObjectID(mPanel->getTaskUUID()); } } } BOOL LLTaskMaterialBridge::removeItem() { - LLFloaterReg::hideInstance("preview_notecard", LLSD(mUUID)); + LLFloaterReg::hideInstance("material_editor", LLSD(mUUID)); return LLTaskInvFVBridge::removeItem(); } -- cgit v1.2.3 From 144fb0c315b5db9ddb275110ca923965ff8bbb49 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 28 Sep 2022 20:18:21 +0300 Subject: SL-18233 Fixed editor not udpating after saving material from task inventory --- indra/newview/llmaterialeditor.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 1592235dba..3245c6629a 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1007,11 +1007,15 @@ void LLMaterialEditor::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, L void LLMaterialEditor::finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUID taskId) { - LLMaterialEditor* me = LLFloaterReg::findTypedInstance("material_editor", LLSD(itemId)); + LLSD floater_key; + floater_key["taskid"] = taskId; + floater_key["itemid"] = itemId; + LLMaterialEditor* me = LLFloaterReg::findTypedInstance("material_editor", floater_key); if (me) { me->setAssetId(newAssetId); me->refreshFromInventory(); + me->setEnabled(true); } } @@ -1048,7 +1052,17 @@ void LLMaterialEditor::refreshFromInventory(const LLUUID& new_item_id) if (new_item_id.notNull()) { mItemUUID = new_item_id; - setKey(LLSD(new_item_id)); + if (mObjectUUID.isNull()) + { + setKey(LLSD(new_item_id)); + } + else + { + LLSD floater_key; + floater_key["taskid"] = new_item_id; + floater_key["itemid"] = mObjectUUID; + setKey(floater_key); + } } LL_DEBUGS() << "LLPreviewNotecard::refreshFromInventory()" << LL_ENDL; loadAsset(); -- cgit v1.2.3