summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2024-07-04 14:06:57 +0300
committerGitHub <noreply@github.com>2024-07-04 14:06:57 +0300
commitfb11243dd0b3445ae8ad03faf09927f542412b46 (patch)
tree90e659aa194b15bf61eae93dd454aad75a3e9c4c /indra/newview
parentd4aeeaf31511b3abe58d0c386fecf34e54632422 (diff)
parenta877e3a0994a19d522e77d6781844341197dd6dc (diff)
Use llsd::toMap() to return LLSD maps from "LLAppearance" listener.
Use llsd::toMap() to return LLSD maps from "LLAppearance" listener.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappearancelistener.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/indra/newview/llappearancelistener.cpp b/indra/newview/llappearancelistener.cpp
index b29eb48a1b..2a3133433a 100644
--- a/indra/newview/llappearancelistener.cpp
+++ b/indra/newview/llappearancelistener.cpp
@@ -127,12 +127,9 @@ void LLAppearanceListener::getOutfitsList(LLSD const &data)
LLIsType is_category(LLAssetType::AT_CATEGORY);
gInventory.collectDescendentsIf(outfits_id, cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, is_category);
- LLSD outfits_data;
- for (const LLPointer<LLViewerInventoryCategory> &cat : cat_array)
- {
- outfits_data[cat->getUUID().asString()] = cat->getName();
- }
- response["outfits"] = outfits_data;
+ response["outfits"] = llsd::toMap(cat_array,
+ [](const LLPointer<LLViewerInventoryCategory> &cat)
+ { return std::make_pair(cat->getUUID().asString(), cat->getName()); });
}
void LLAppearanceListener::getOutfitItems(LLSD const &data)
@@ -150,16 +147,14 @@ void LLAppearanceListener::getOutfitItems(LLSD const &data)
LLFindOutfitItems collector = LLFindOutfitItems();
gInventory.collectDescendentsIf(outfit_id, cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, collector);
- LLSD items_data;
- for (const LLPointer<LLViewerInventoryItem> &it : item_array)
- {
- LLSD info;
- info["name"] = it->getName();
- info["wearable_type"] = LLWearableType::getInstance()->getTypeName(it->isWearableType() ? it->getWearableType() : LLWearableType::WT_NONE);
- info["is_worn"] = get_is_item_worn(it);
-
- items_data[it->getUUID().asString()] = info;
- }
-
- response["items"] = items_data;
+ response["items"] = llsd::toMap(item_array,
+ [](const LLPointer<LLViewerInventoryItem> &it)
+ {
+ return std::make_pair(
+ it->getUUID().asString(),
+ llsd::map(
+ "name", it->getName(),
+ "wearable_type", LLWearableType::getInstance()->getTypeName(it->isWearableType() ? it->getWearableType() : LLWearableType::WT_NONE),
+ "is_worn", get_is_item_worn(it)));
+ });
}