Merge pull request #41 from AngeldarkRaymaker/Fire-31508

FIRE-31508: check folder limit before attaching all the things in a f…
meow-7.2.2
Ansariel Hiller 2024-08-21 16:22:12 +02:00 committed by GitHub
commit f3e186379c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 14 deletions

View File

@ -3680,6 +3680,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
// <FS:TT> Patch: ReplaceWornItemsOnly
else if ("replaceitems" == action)
{
//<FS:AR> FIRE-31508: check folder limit
if (modifyOutfitExceedsWearFolderLimit())
return;
//</FS:AR> FIRE-31508
LLInventoryModel* model = getInventoryModel();
if(!model) return;
LLViewerInventoryCategory* cat = getCategory();
@ -5368,32 +5373,68 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::ETyp
LLAgentWearables::createWearable(type, false, parent_id);
}
void LLFolderBridge::modifyOutfit(BOOL append)
//<FS:AR> FIRE-31508: refactored from void LLFolderBridge::modifyOutfit(BOOL append)
bool LLFolderBridge::modifyOutfitExceedsWearFolderLimit()
{
LLInventoryModel* model = getInventoryModel();
if(!model) return;
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
LLViewerInventoryCategory *cat = getCategory();
if (!cat)
return false;
// checking amount of items to wear
U32 max_items = gSavedSettings.getU32("WearFolderLimit");
LLInventoryModel::cat_array_t cats;
U32 max_items = gSavedSettings.getU32("WearFolderLimit");
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
gInventory.collectDescendentsIf(cat->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
not_worn);
LLFindWearablesEx not_worn(/*is_worn=*/false, /*include_body_parts=*/false);
gInventory.collectDescendentsIf(cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, not_worn);
if (items.size() > max_items)
{
LLSD args;
args["AMOUNT"] = llformat("%d", max_items);
LLNotificationsUtil::add("TooManyWearables", args);
return;
return true;
}
return false;
}
//</FS:AR> FIRE-31508
void LLFolderBridge::modifyOutfit(BOOL append)
{
// <FS:AR> FIRE-31508: Commented out for slight efficiency.
// LLInventoryModel* model = getInventoryModel();
// if(!model) return;
// LLViewerInventoryCategory* cat = getCategory();
// if(!cat) return;
// <FS:AR/> FIRE-31508
//<FS:AR> FIRE-31508: refactored to bool modifyOutfitExceedsWearFolderLimit(), rather than duplicating code
//// checking amount of items to wear
//U32 max_items = gSavedSettings.getU32("WearFolderLimit");
//LLInventoryModel::cat_array_t cats;
//LLInventoryModel::item_array_t items;
//LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
//gInventory.collectDescendentsIf(cat->getUUID(),
// cats,
// items,
// LLInventoryModel::EXCLUDE_TRASH,
// not_worn);
//if (items.size() > max_items)
//{
// LLSD args;
// args["AMOUNT"] = llformat("%d", max_items);
// LLNotificationsUtil::add("TooManyWearables", args);
// return;
//}
if (modifyOutfitExceedsWearFolderLimit())
return;
LLViewerInventoryCategory *cat = getCategory();
if (!cat)
return;
//</FS:AR> FIRE-31508
if (isAgentInventory())
{
LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append);

View File

@ -389,6 +389,7 @@ protected:
BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck);
bool modifyOutfitExceedsWearFolderLimit(); //<FS:AR> FIRE-31508
void modifyOutfit(BOOL append);
void copyOutfitToClipboard();
void determineFolderType();