Skip to content
Snippets Groups Projects
Commit 6be8313c authored by Sergei Litovchuk's avatar Sergei Litovchuk
Browse files

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
parent 462b629b
No related branches found
No related tags found
No related merge requests found
...@@ -1055,25 +1055,37 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) ...@@ -1055,25 +1055,37 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
void LLOutfitsList::onCOFChanged() 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(); // Collect current COF items
for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin(); gInventory.collectDescendents(
iter != changed_items.end(); LLAppearanceMgr::instance().getCOF(),
++iter) 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); vnew.push_back((*iter)->getLinkedUUID());
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());
}
} }
// 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(); for (outfits_map_t::iterator iter = mOutfitsMap.begin();
iter != mOutfitsMap.end(); iter != mOutfitsMap.end();
++iter) ++iter)
...@@ -1084,9 +1096,13 @@ void LLOutfitsList::onCOFChanged() ...@@ -1084,9 +1096,13 @@ void LLOutfitsList::onCOFChanged()
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView()); LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
if (!list) continue; 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 // Every list updates the labels of changed items or
// the links that point to these items. // the links that point to these items.
list->updateChangedItems(changed_linked_items); list->updateChangedItems(vadded);
} }
} }
......
...@@ -214,6 +214,10 @@ class LLOutfitsList : public LLPanelAppearanceTab ...@@ -214,6 +214,10 @@ class LLOutfitsList : public LLPanelAppearanceTab
typedef outfits_map_t::value_type outfits_map_value_t; typedef outfits_map_t::value_type outfits_map_value_t;
outfits_map_t mOutfitsMap; outfits_map_t mOutfitsMap;
// IDs of original items which are worn and linked in COF.
// Used to monitor COF changes for updating items worn state. See EXT-8636.
uuid_vec_t mCOFLinkedItems;
LLOutfitListGearMenu* mGearMenu; LLOutfitListGearMenu* mGearMenu;
LLListContextMenu* mOutfitMenu; LLListContextMenu* mOutfitMenu;
......
...@@ -124,7 +124,11 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name, ...@@ -124,7 +124,11 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name,
{ {
std::string search_label = name; std::string search_label = name;
if (mWornIndicationEnabled && get_is_item_worn(mInventoryItemUUID)) // Updating item's worn status depending on whether it is linked in COF or not.
// We don't use get_is_item_worn() here because this update is triggered by
// an inventory observer upon link in COF beind added or removed so actual
// worn status of a linked item may still remain unchanged.
if (mWornIndicationEnabled && LLAppearanceMgr::instance().isLinkInCOF(mInventoryItemUUID))
{ {
search_label += LLTrans::getString("worn"); search_label += LLTrans::getString("worn");
item_state = IS_WORN; item_state = IS_WORN;
...@@ -659,7 +663,7 @@ void LLWearableItemsList::updateList(const LLUUID& category_id) ...@@ -659,7 +663,7 @@ void LLWearableItemsList::updateList(const LLUUID& category_id)
refreshList(item_array); refreshList(item_array);
} }
void LLWearableItemsList::updateChangedItems(const LLInventoryModel::changed_items_t& changed_items_uuids) void LLWearableItemsList::updateChangedItems(const uuid_vec_t& changed_items_uuids)
{ {
// nothing to update // nothing to update
if (changed_items_uuids.empty()) return; if (changed_items_uuids.empty()) return;
...@@ -681,7 +685,7 @@ void LLWearableItemsList::updateChangedItems(const LLInventoryModel::changed_ite ...@@ -681,7 +685,7 @@ void LLWearableItemsList::updateChangedItems(const LLInventoryModel::changed_ite
LLUUID linked_uuid = inv_item->getLinkedUUID(); LLUUID linked_uuid = inv_item->getLinkedUUID();
for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items_uuids.begin(); for (uuid_vec_t::const_iterator iter = changed_items_uuids.begin();
iter != changed_items_uuids.end(); iter != changed_items_uuids.end();
++iter) ++iter)
{ {
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
// newview // newview
#include "llinventoryitemslist.h" #include "llinventoryitemslist.h"
#include "llinventorylistitem.h" #include "llinventorylistitem.h"
#include "llinventorymodel.h"
#include "lllistcontextmenu.h" #include "lllistcontextmenu.h"
#include "llwearabletype.h" #include "llwearabletype.h"
...@@ -441,7 +440,7 @@ class LLWearableItemsList : public LLInventoryItemsList ...@@ -441,7 +440,7 @@ class LLWearableItemsList : public LLInventoryItemsList
* Update items that match UUIDs from changed_items_uuids * Update items that match UUIDs from changed_items_uuids
* or links that point at such items. * or links that point at such items.
*/ */
void updateChangedItems(const LLInventoryModel::changed_items_t& changed_items_uuids); void updateChangedItems(const uuid_vec_t& changed_items_uuids);
bool isStandalone() const { return mIsStandalone; } bool isStandalone() const { return mIsStandalone; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment