From ee8b96f3ef55d10f5b84e368c052692a362ebcbc Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 3 Nov 2023 13:49:47 -0700 Subject: SL-20553: Clean up dead code --- indra/newview/llmaterialeditor.cpp | 58 ++--------------------------------- indra/newview/llmaterialeditor.h | 1 - indra/newview/llviewerinventory.cpp | 61 ------------------------------------- indra/newview/llviewerinventory.h | 5 --- 4 files changed, 2 insertions(+), 123 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index cc7e69d60c..958925c9e4 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2123,63 +2123,9 @@ void LLMaterialEditor::saveObjectsMaterialAs(const LLGLTFMaterial* render_materi } else { - if (item_id.notNull() && object_id.notNull()) - { - llassert(false); // *TODO: Remove this code path if unused - // Copy existing item from object inventory, and create new composite asset on top of it - LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback, _1, _2, permissions, object_id, item_id)); - } - else - { - LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions)); - } - } -} - -// static -void LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 != option) - { - return; + llassert(object_id.isNull()); // Case for copying item from object inventory is no longer implemented + LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions)); } - - LLSD asset; - asset["version"] = LLGLTFMaterial::ASSET_VERSION; - asset["type"] = LLGLTFMaterial::ASSET_TYPE; - // This is the string serialized from LLGLTFMaterial::asJSON - asset["data"] = notification["payload"]["data"]; - - std::ostringstream str; - LLSDSerialize::serialize(asset, str, LLSDSerialize::LLSD_BINARY); - - LLViewerObject* object = gObjectList.findObject(object_id); - if (!object) - { - return; - } - const LLInventoryItem* item = object->getInventoryItem(item_id); - if (!item) - { - return; - } - - std::string new_name = response["message"].asString(); - LLInventoryObject::correctInventoryName(new_name); - if (new_name.empty()) - { - return; - } - - const LLUUID destination_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL); - - LLPointer cb = new LLObjectsMaterialItemCallback(permissions, str.str(), new_name); - // NOTE: This should be an item copy. Saving a material to an inventory should be disabled when the associated material is no-copy. - move_or_copy_inventory_from_object(destination_id, - object_id, - item_id, - cb); } // static diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 1c40fcc348..2e25a9ca3d 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -116,7 +116,6 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener static bool canSaveObjectsMaterial(); static bool canClipboardObjectsMaterial(); static void saveObjectsMaterialAs(); - static void onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id); static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions); static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5ee613d49d..1b70e5f84f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1658,67 +1658,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id, } } -void move_or_copy_inventory_from_object(const LLUUID& destination_id, - const LLUUID& object_id, - const LLUUID& item_id, - LLPointer cb) -{ - LLViewerObject* object = gObjectList.findObject(object_id); - if (!object) - { - return; - } - const LLInventoryItem* item = object->getInventoryItem(item_id); - if (!item) - { - return; - } - - class LLItemAddedObserver : public LLInventoryObserver - { - public: - LLItemAddedObserver(const LLUUID& copied_asset_id, LLPointer cb) - : LLInventoryObserver(), - mAssetId(copied_asset_id), - mCallback(cb) - { - } - - void changed(U32 mask) override - { - if((mask & (LLInventoryObserver::ADD)) == 0) - { - return; - } - for (const LLUUID& changed_id : gInventory.getChangedIDs()) - { - LLViewerInventoryItem* changed_item = gInventory.getItem(changed_id); - if (changed_item->getAssetUUID() == mAssetId) - { - changeComplete(changed_item->getUUID()); - return; - } - } - } - - private: - void changeComplete(const LLUUID& item_id) - { - mCallback->fire(item_id); - gInventory.removeObserver(this); - delete this; - } - - LLUUID mAssetId; - LLPointer mCallback; - }; - - const LLUUID& asset_id = item->getAssetUUID(); - LLItemAddedObserver* observer = new LLItemAddedObserver(asset_id, cb); - gInventory.addObserver(observer); - object->moveInventory(destination_id, item_id); -} - void create_new_item(const std::string& name, const LLUUID& parent_id, LLAssetType::EType asset_type, diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index bce8da0a69..e043285ffb 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -463,11 +463,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id, const LLInventoryItem *src, U32 callback_id = 0); -void move_or_copy_inventory_from_object(const LLUUID& destination_id, - const LLUUID& object_id, - const LLUUID& item_id, - LLPointer cb); - void menu_create_inventory_item(LLInventoryPanel* root, LLFolderBridge* bridge, const LLSD& userdata, -- cgit v1.2.3