summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitslist.cpp
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-08-16 23:23:48 +0300
committerSergei Litovchuk <slitovchuk@productengine.com>2010-08-16 23:23:48 +0300
commitef46496775bca913f00747558e780aa0449d92bc (patch)
treeb856b194b8447d7611dc77fe6e220e7dd7954535 /indra/newview/lloutfitslist.cpp
parent6c8494295ad05b127338681f8341dd5c9f53f9ea (diff)
EXT-8636 FIXED updating wearables (worn) prefix in 'My Outfits' list.
- Fixed LLOutfitsList COF changes handler to update worn status of items removed from COF. Now they are updated based on the differences in original items' ids in COF. - Fixed 'My Outfits' items worn status check to update depending on whether the item is linked in COF or not. This is a kind of workaround to fix updating attachments' worn status because LLAppearanceMgr::updateAppearanceFromCOF is triggered erlier than new attachment links are fetched. When dumpItemArray(obj_items,"asset_dump: obj_item") is called from LLAppearanceMgr::updateAppearanceFromCOF, all attachment links have empty asset ids. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/859/. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r--indra/newview/lloutfitslist.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 2b6c80bac8..a471158c3d 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -1055,25 +1055,37 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
void LLOutfitsList::onCOFChanged()
{
- LLInventoryModel::changed_items_t changed_linked_items;
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
- const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs();
- for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin();
- iter != changed_items.end();
- ++iter)
+ // Collect current COF items
+ gInventory.collectDescendents(
+ LLAppearanceMgr::instance().getCOF(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+
+ uuid_vec_t vnew;
+ uuid_vec_t vadded;
+ uuid_vec_t vremoved;
+
+ // From gInventory we get the UUIDs of links that are currently in COF.
+ // These links UUIDs are not the same UUIDs that we have in each wearable items list.
+ // So we collect base items' UUIDs to find them or links that point to them in wearable
+ // items lists and update their worn state there.
+ for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
+ iter != item_array.end();
+ ++iter)
{
- LLViewerInventoryItem* item = gInventory.getItem(*iter);
- if (item)
- {
- // From gInventory we get the UUIDs of new links added to COF
- // or removed from COF. These links UUIDs are not the same UUIDs
- // that we have in each wearable items list. So we collect base items
- // UUIDs to find all items or links that point to same base items in wearable
- // items lists and update their worn state there.
- changed_linked_items.insert(item->getLinkedUUID());
- }
+ vnew.push_back((*iter)->getLinkedUUID());
}
+ // We need to update only items that were added or removed from COF.
+ LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved);
+
+ // Store the ids of items currently linked from COF.
+ mCOFLinkedItems = vnew;
+
for (outfits_map_t::iterator iter = mOutfitsMap.begin();
iter != mOutfitsMap.end();
++iter)
@@ -1084,9 +1096,13 @@ void LLOutfitsList::onCOFChanged()
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
if (!list) continue;
+ // Append removed ids to added ids because we should update all of them.
+ vadded.reserve(vadded.size() + vremoved.size());
+ vadded.insert(vadded.end(), vremoved.begin(), vremoved.end());
+
// Every list updates the labels of changed items or
// the links that point to these items.
- list->updateChangedItems(changed_linked_items);
+ list->updateChangedItems(vadded);
}
}