summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-04 15:31:19 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-04 15:31:19 -0800
commitc9868071b113b251e03d95163118b696e28bbe98 (patch)
tree8428d2e97f7a61b1a10e7e10494199a39969369d /indra/newview/llinventorybridge.cpp
parente833e7ad442f5b59f95c6ccfcaaf1d103d247d69 (diff)
parente8659e0e13c65308ad2f036dc7e7ccff0e665976 (diff)
Merge from trunk. Conflicts manually resolved in:
U indra/llui/lluictrlfactory.cpp U indra/newview/llinventorybridge.cpp U indra/newview/llviewertexture.cpp U indra/newview/llviewertexture.h
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp74
1 files changed, 62 insertions, 12 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 922cb53a35..8cc53cd93c 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4570,18 +4570,8 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
}
else if (isRemoveAction(action))
{
- if (get_is_item_worn(mUUID))
- {
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLWearableList::instance().getAsset(item->getAssetUUID(),
- item->getName(),
- item->getType(),
- LLWearableBridge::onRemoveFromAvatarArrived,
- new OnRemoveStruct(mUUID));
- }
- }
+ removeFromAvatar();
+ return;
}
else LLItemBridge::performAction(folder, model, action);
}
@@ -4964,6 +4954,66 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
delete on_remove_struct;
}
+/* static */
+void LLWearableBridge::removeAllClothesFromAvatar()
+{
+ // Remove COF links.
+ for (S32 itype = WT_SHAPE; itype < WT_COUNT; ++itype)
+ {
+ if (itype == WT_SHAPE || itype == WT_SKIN || itype == WT_HAIR || itype == WT_EYES)
+ continue;
+
+ // MULTI-WEARABLES: fixed to index 0
+ LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(
+ gAgentWearables.getWearableInventoryItem((EWearableType)itype, 0));
+ if (!item)
+ continue;
+ const LLUUID &item_id = gInventory.getLinkedItemID(item->getUUID());
+ const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
+ if (!wearable)
+ continue;
+
+ // Find and remove this item from the COF.
+ LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(
+ item_id, LLAppearanceManager::instance().getCOF());
+ llassert(items.size() == 1); // Should always have one and only one item linked to this in the COF.
+ for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
+ iter != items.end();
+ ++iter)
+ {
+ const LLViewerInventoryItem *linked_item = (*iter);
+ const LLUUID &item_id = linked_item->getUUID();
+ gInventory.purgeObject(item_id);
+ }
+ }
+ gInventory.notifyObservers();
+
+ // Remove wearables from gAgentWearables
+ LLAgentWearables::userRemoveAllClothes();
+}
+
+/* static */
+void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item)
+{
+ if (item)
+ {
+ LLWearableList::instance().getAsset(item->getAssetUUID(),
+ item->getName(),
+ item->getType(),
+ LLWearableBridge::onRemoveFromAvatarArrived,
+ new OnRemoveStruct(item->getUUID()));
+ }
+}
+
+void LLWearableBridge::removeFromAvatar()
+{
+ if (get_is_item_worn(mUUID))
+ {
+ LLViewerInventoryItem* item = getItem();
+ removeItemFromAvatar(item);
+ }
+}
+
// +=================================================+
// | LLMeshBridge |