EXT-8063 WIP - last-ditch filtering of item counts in updateAppearanceFromCOF
parent
84f1f65af0
commit
5a39e173b0
|
|
@ -1537,16 +1537,79 @@ bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* it
|
|||
return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription();
|
||||
}
|
||||
|
||||
void item_array_diff(LLInventoryModel::item_array_t& full_list,
|
||||
LLInventoryModel::item_array_t& keep_list,
|
||||
LLInventoryModel::item_array_t& kill_list)
|
||||
|
||||
{
|
||||
for (LLInventoryModel::item_array_t::iterator it = full_list.begin();
|
||||
it != full_list.end();
|
||||
++it)
|
||||
{
|
||||
LLViewerInventoryItem *item = *it;
|
||||
if (keep_list.find(item) < 0) // Why on earth does LLDynamicArray need to redefine find()?
|
||||
{
|
||||
kill_list.push_back(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLAppearanceMgr::enforceItemCountLimits()
|
||||
{
|
||||
S32 purge_count = 0;
|
||||
|
||||
LLInventoryModel::item_array_t body_items;
|
||||
getDescendentsOfAssetType(getCOF(), body_items, LLAssetType::AT_BODYPART, false);
|
||||
LLInventoryModel::item_array_t curr_body_items = body_items;
|
||||
removeDuplicateItems(body_items);
|
||||
filterWearableItems(body_items, 1);
|
||||
LLInventoryModel::item_array_t kill_body_items;
|
||||
item_array_diff(curr_body_items,body_items,kill_body_items);
|
||||
for (LLInventoryModel::item_array_t::iterator it = kill_body_items.begin();
|
||||
it != kill_body_items.end();
|
||||
++it)
|
||||
{
|
||||
LLViewerInventoryItem *item = *it;
|
||||
llinfos << "purging dup body part " << item->getName() << llendl;
|
||||
gInventory.purgeObject(item->getUUID());
|
||||
purge_count++;
|
||||
}
|
||||
|
||||
LLInventoryModel::item_array_t wear_items;
|
||||
getDescendentsOfAssetType(getCOF(), wear_items, LLAssetType::AT_CLOTHING, false);
|
||||
LLInventoryModel::item_array_t curr_wear_items = wear_items;
|
||||
removeDuplicateItems(wear_items);
|
||||
filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_PER_TYPE);
|
||||
LLInventoryModel::item_array_t kill_wear_items;
|
||||
item_array_diff(curr_wear_items,wear_items,kill_wear_items);
|
||||
for (LLInventoryModel::item_array_t::iterator it = kill_wear_items.begin();
|
||||
it != kill_wear_items.end();
|
||||
++it)
|
||||
{
|
||||
LLViewerInventoryItem *item = *it;
|
||||
llinfos << "purging excess clothing item " << item->getName() << llendl;
|
||||
gInventory.purgeObject(item->getUUID());
|
||||
purge_count++;
|
||||
}
|
||||
|
||||
if (purge_count>0)
|
||||
{
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
//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();
|
||||
|
||||
enforceItemCountLimits();
|
||||
|
||||
updateIsDirty();
|
||||
|
||||
dumpCat(getCOF(),"COF, start");
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public:
|
|||
void renameOutfit(const LLUUID& outfit_id);
|
||||
void takeOffOutfit(const LLUUID& cat_id);
|
||||
void addCategoryToCurrentOutfit(const LLUUID& cat_id);
|
||||
void enforceItemCountLimits();
|
||||
|
||||
// Copy all items and the src category itself.
|
||||
void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue