From 76c8cca9363c0ef55bf66a2bbff4a86a02f37acf Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 7 Aug 2023 14:26:33 -0700 Subject: SL-20024: Fix author attributions not transferring for saved object materials, fix item not renamed --- indra/newview/llviewerinventory.cpp | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 518967709d..b722e715b6 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1604,6 +1604,69 @@ 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) +{ + // TODO: Implement + + 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, -- cgit v1.2.3 From 57cc252fd6e3956d53da3c4eb4cad512ddf75e8c Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 7 Aug 2023 16:31:03 -0700 Subject: SL-20024: Miscellaneous cleanup --- indra/newview/llviewerinventory.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b722e715b6..aa1827a8e2 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1609,8 +1609,6 @@ void move_or_copy_inventory_from_object(const LLUUID& destination_id, const LLUUID& item_id, LLPointer cb) { - // TODO: Implement - LLViewerObject* object = gObjectList.findObject(object_id); if (!object) { -- cgit v1.2.3