diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 22c488a892..b7ed38fef0 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3680,6 +3680,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) // Patch: ReplaceWornItemsOnly else if ("replaceitems" == action) { + // FIRE-31508: check folder limit + if (modifyOutfitExceedsWearFolderLimit()) + return; + // 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) +// 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; +} +// FIRE-31508 + +void LLFolderBridge::modifyOutfit(BOOL append) +{ + // FIRE-31508: Commented out for slight efficiency. + // LLInventoryModel* model = getInventoryModel(); + // if(!model) return; + // LLViewerInventoryCategory* cat = getCategory(); + // if(!cat) return; + // FIRE-31508 + + // 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; + // FIRE-31508 + if (isAgentInventory()) { LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index bda5dca77a..d5210b79ca 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -389,6 +389,7 @@ protected: BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck); + bool modifyOutfitExceedsWearFolderLimit(); // FIRE-31508 void modifyOutfit(BOOL append); void copyOutfitToClipboard(); void determineFolderType();