diff options
author | Nat Linden <nat@lindenlab.com> | 2022-09-19 21:21:21 +0000 |
---|---|---|
committer | Nat Linden <nat@lindenlab.com> | 2022-09-19 21:21:21 +0000 |
commit | 9ac0b3da77ca0c54161803f23cc37c09e871799d (patch) | |
tree | ec9575c248d6e9cd01d8d15471ceb952c7dba738 /indra/newview/llinventoryfunctions.cpp | |
parent | 5f1c8d311904bd3937f5ba70476e16233f7d21c1 (diff) | |
parent | f39be1dfd30032f10f21cccc29e93c1c49f01df5 (diff) |
SL-18068: Merged DRTVWR-565-maint-P into sl-18068
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 27edc8148e..fb73d391ec 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2583,8 +2583,62 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root } std::set<LLUUID> selected_uuid_set = LLAvatarActions::getInventorySelectedUUIDs(); + + // copy list of applicable items into a vector for bulk handling uuid_vec_t ids; - std::copy(selected_uuid_set.begin(), selected_uuid_set.end(), std::back_inserter(ids)); + if (action == "wear" || action == "wear_add") + { + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + const LLUUID mp_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + std::copy_if(selected_uuid_set.begin(), + selected_uuid_set.end(), + std::back_inserter(ids), + [trash_id, mp_id](LLUUID id) + { + if (get_is_item_worn(id) + || LLAppearanceMgr::instance().getIsInCOF(id) + || gInventory.isObjectDescendentOf(id, trash_id)) + { + return false; + } + if (mp_id.notNull() && gInventory.isObjectDescendentOf(id, mp_id)) + { + return false; + } + LLInventoryObject* obj = (LLInventoryObject*)gInventory.getObject(id); + if (!obj) + { + return false; + } + if (obj->getIsLinkType() && gInventory.isObjectDescendentOf(obj->getLinkedUUID(), trash_id)) + { + return false; + } + if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType())) + { + // missing + return false; + } + return true; + } + ); + } + else if (isRemoveAction(action)) + { + std::copy_if(selected_uuid_set.begin(), + selected_uuid_set.end(), + std::back_inserter(ids), + [](LLUUID id) + { + return get_is_item_worn(id); + } + ); + } + else + { + std::copy(selected_uuid_set.begin(), selected_uuid_set.end(), std::back_inserter(ids)); + } + // Check for actions that get handled in bulk if (action == "wear") { |