diff options
author | Igor Borovkov <iborovkov@productengine.com> | 2010-04-27 13:46:51 +0300 |
---|---|---|
committer | Igor Borovkov <iborovkov@productengine.com> | 2010-04-27 13:46:51 +0300 |
commit | e8d9dd46bda601fcc6bcb0cf855a81f39a2e01b0 (patch) | |
tree | 32337593fc299fe54764e3e0f8fdbc67e5d00b7e /indra | |
parent | 611dfccfcb58878d24d65e50eca0f2364bb16ee5 (diff) |
additional fix for EXT-6721 (Enable UI for user modification of wearable order)
corrected dirty state management - taking into account changes in ordering between wearables of COF and Base Outfit
Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/280/
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 6aefecc787..5586b3cd4d 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1059,6 +1059,10 @@ bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* it void LLAppearanceMgr::updateAppearanceFromCOF() { + //checking integrity of the COF in terms of ordering of wearables, + //checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state) + updateClothingOrderingInfo(); + // update dirty flag to see if the state of the COF matches // the saved outfit stored as a folder link llinfos << "starting" << llendl; @@ -1067,8 +1071,6 @@ void LLAppearanceMgr::updateAppearanceFromCOF() dumpCat(getCOF(),"COF, start"); - updateClothingOrderingInfo(); - bool follow_folder_links = true; LLUUID current_outfit_id = getCOF(); @@ -1523,6 +1525,17 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update) } } +bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInventoryItem* item2) +{ + if (!item1 || !item2) + { + llwarning("item1, item2 cannot be null, something is very wrong", 0); + return true; + } + + return item1->getLinkedUUID() < item2->getLinkedUUID(); +} + void LLAppearanceMgr::updateIsDirty() { LLUUID cof = getCOF(); @@ -1562,33 +1575,37 @@ void LLAppearanceMgr::updateIsDirty() // Current outfit folder should have one more item than the outfit folder. // this one item is the link back to the outfit folder itself. mOutfitIsDirty = true; + return; } - else - { - typedef std::set<LLUUID> item_set_t; - item_set_t cof_set; - item_set_t outfit_set; - // sort COF items by UUID - for (S32 i = 0; i < cof_items.count(); ++i) + //getting rid of base outfit folder link to simplify comparison + for (LLInventoryModel::item_array_t::iterator it = cof_items.begin(); it != cof_items.end(); ++it) + { + if (*it == base_outfit_item) { - LLViewerInventoryItem *item = cof_items.get(i); - // don't add the base outfit link to the list of objects we're comparing - if(item != base_outfit_item) - { - cof_set.insert(item->getLinkedUUID()); - } + cof_items.erase(it); + break; } + } - // sort outfit folder by UUID - for (S32 i = 0; i < outfit_items.count(); ++i) + //"dirty" - also means a difference in linked UUIDs and/or a difference in wearables order (links' descriptions) + std::sort(cof_items.begin(), cof_items.end(), sort_by_linked_uuid); + std::sort(outfit_items.begin(), outfit_items.end(), sort_by_linked_uuid); + + for (U32 i = 0; i < cof_items.size(); ++i) + { + LLViewerInventoryItem *item1 = cof_items.get(i); + LLViewerInventoryItem *item2 = outfit_items.get(i); + + if (item1->getLinkedUUID() != item2->getLinkedUUID() || + item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription()) { - LLViewerInventoryItem *item = outfit_items.get(i); - outfit_set.insert(item->getLinkedUUID()); + mOutfitIsDirty = true; + return; } - - mOutfitIsDirty = (outfit_set != cof_set); } + + mOutfitIsDirty = false; } } |