diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-07-03 14:05:25 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-07-03 14:05:25 -0400 |
commit | a877e3a0994a19d522e77d6781844341197dd6dc (patch) | |
tree | 90e659aa194b15bf61eae93dd454aad75a3e9c4c /indra | |
parent | 32ebcebe03ad40a4a2b11fb62022d622b46e56e1 (diff) |
Use llsd::toMap() to return LLSD maps from "LLAppearance" listener.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llappearancelistener.cpp | 31 |
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))); + }); } |