summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-09-07 13:58:19 -0700
committerLeslie Linden <leslie@lindenlab.com>2011-09-07 13:58:19 -0700
commit78821c51a1f7d5fcc6e4a2678bfd3446ccfaee36 (patch)
tree51da53114f257ca57c2aa36da655019b75cf0269 /indra/newview/llinventorybridge.cpp
parentc64bd7d5cb28fc221716e866ff9c9a28c22e69ce (diff)
parentfef401a1768bae9bfb23a13549fa3a5005f2c7ae (diff)
Merge from viewer-experience
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index fb5d145637..b4dac28595 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5220,31 +5220,22 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
// static
void LLWearableBridge::removeAllClothesFromAvatar()
{
- // Remove COF links.
- for (S32 itype = LLWearableType::WT_SHAPE; itype < LLWearableType::WT_COUNT; ++itype)
- {
- if (itype == LLWearableType::WT_SHAPE || itype == LLWearableType::WT_SKIN || itype == LLWearableType::WT_HAIR || itype == LLWearableType::WT_EYES)
- continue;
-
- for (S32 index = gAgentWearables.getWearableCount(itype)-1; index >= 0 ; --index)
- {
- LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
- gAgentWearables.getWearableInventoryItem((LLWearableType::EType)itype, index));
- if (!item)
- continue;
- const LLUUID &item_id = item->getUUID();
- const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
- if (!wearable)
- continue;
-
- // Find and remove this item from the COF.
- LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
- }
+ // Fetch worn clothes (i.e. the ones in COF).
+ LLInventoryModel::item_array_t clothing_items;
+ LLInventoryModel::cat_array_t dummy;
+ LLIsType is_clothing(LLAssetType::AT_CLOTHING);
+ gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(),
+ dummy,
+ clothing_items,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_clothing,
+ false);
+
+ // Take them off by removing from COF.
+ for (LLInventoryModel::item_array_t::const_iterator it = clothing_items.begin(); it != clothing_items.end(); ++it)
+ {
+ LLAppearanceMgr::instance().removeItemFromAvatar((*it)->getUUID());
}
- gInventory.notifyObservers();
-
- // Remove wearables from gAgentWearables
- LLAgentWearables::userRemoveAllClothes();
}
// static