summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Payne <vir@lindenlab.com>2009-09-25 15:18:34 +0000
committerBradley Payne <vir@lindenlab.com>2009-09-25 15:18:34 +0000
commitaf774fc9dbfd8550d61981b49151b60a7eaade91 (patch)
tree02406e2fbab2e6b67d2fb04dd5d4d036fef1ea53
parent8bdd77f1fda47628815230fe6276bfae4cfb3b82 (diff)
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.
-rw-r--r--indra/newview/llappearancemgr.cpp39
1 files changed, 31 insertions, 8 deletions
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<LLInventoryCallback> 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; i<item_array.count(); i++)
+ {
+ const LLInventoryItem* inv_item = item_array.get(i).get();
+ if (inv_item->getLinkedUUID() == item->getLinkedUUID())
+ {
+ linked_already = true;
+ break;
+ }
+ }
+ if (linked_already)
+ {
+ if (do_update)
+ LLAppearanceManager::updateAppearanceFromCOF();
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = do_update ? new ModifiedCOFCallback : 0;
+ link_inventory_item( gAgent.getID(),
+ item->getLinkedUUID(),
+ getCOF(),
+ item->getName(),
+ LLAssetType::AT_LINK,
+ cb);
+ }
}
/* static */