summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewerinventory.cpp78
1 files changed, 14 insertions, 64 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 5da77ecdb9..03e15c7ee5 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1094,72 +1094,22 @@ void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, co
LLInventoryType::IT_GESTURE,
PERM_ALL);
}
- else if ("shirt" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_SHIRT);
- }
- else if ("pants" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_PANTS);
- }
- else if ("shoes" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_SHOES);
- }
- else if ("socks" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_SOCKS);
- }
- else if ("jacket" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_JACKET);
- }
- else if ("skirt" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_SKIRT);
- }
- else if ("gloves" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_GLOVES);
- }
- else if ("undershirt" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_UNDERSHIRT);
- }
- else if ("underpants" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
- LLFolderBridge::createWearable(parent_id, WT_UNDERPANTS);
- }
- else if ("shape" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART);
- LLFolderBridge::createWearable(parent_id, WT_SHAPE);
- }
- else if ("skin" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART);
- LLFolderBridge::createWearable(parent_id, WT_SKIN);
- }
- else if ("hair" == type_name)
- {
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART);
- LLFolderBridge::createWearable(parent_id, WT_HAIR);
- }
- else if ("eyes" == type_name)
+ else
{
- const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART);
- LLFolderBridge::createWearable(parent_id, WT_EYES);
+ // Use for all clothing and body parts. Adding new wearable types requires updating LLWearableDictionary.
+ EWearableType wearable_type = LLWearableDictionary::typeNameToType(type_name);
+ if (wearable_type >= WT_SHAPE && wearable_type < WT_COUNT)
+ {
+ LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(wearable_type);
+ LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type);
+ const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(folder_type);
+ LLFolderBridge::createWearable(parent_id, wearable_type);
+ }
+ else
+ {
+ llwarns << "Can't create unrecognized type " << type_name << llendl;
+ }
}
-
folder->setNeedsAutoRename(TRUE);
}