From af774fc9dbfd8550d61981b49151b60a7eaade91 Mon Sep 17 00:00:00 2001 From: Bradley Payne Date: Fri, 25 Sep 2009 15:18:34 +0000 Subject: For EXT-1121: Attaching / detaching objects doesn't affect the Current Outfit folder and EXT-1090: Attachments detach on login. This is still in short term fix territory - trying to avoid creating duplicate attachment links when wearing outfits. It's not 100% robust because of the possibility of race conditions. --- indra/newview/llappearancemgr.cpp | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 74a8d8fe15..dfed1cb57a 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -863,14 +863,37 @@ void LLAppearanceManager::wearOutfitByName(const std::string& name) /* static */ void LLAppearanceManager::wearItem( LLInventoryItem* item, bool do_update ) { - // BAP add check for already in COF. - LLPointer cb = do_update ? new ModifiedCOFCallback : 0; - link_inventory_item( gAgent.getID(), - item->getLinkedUUID(), - getCOF(), - item->getName(), - LLAssetType::AT_LINK, - cb); + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceManager::getCOF(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH); + bool linked_already = false; + for (S32 i=0; igetLinkedUUID() == item->getLinkedUUID()) + { + linked_already = true; + break; + } + } + if (linked_already) + { + if (do_update) + LLAppearanceManager::updateAppearanceFromCOF(); + } + else + { + LLPointer cb = do_update ? new ModifiedCOFCallback : 0; + link_inventory_item( gAgent.getID(), + item->getLinkedUUID(), + getCOF(), + item->getName(), + LLAssetType::AT_LINK, + cb); + } } /* static */ -- cgit v1.2.3