summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2009-12-23 15:15:49 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2009-12-23 15:15:49 -0500
commit5c8b2deb82cfe753d6fe25e418f99f05d76e0b73 (patch)
tree23519ec1ae0eb3f9396b1e977d08449d23e703fa
parent55c1f18c8d70304653d21373d3b71130123945b2 (diff)
For EXT-3622: Take off item, wear a different item --> first item is put on again. Fixed the 'remove all clothing' case.
-rw-r--r--indra/newview/llinventorybridge.cpp38
-rw-r--r--indra/newview/llinventorybridge.h1
-rw-r--r--indra/newview/llviewermenu.cpp2
3 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index beecd48419..d70221b22a 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4940,6 +4940,44 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
}
/* 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)
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index c93fc85a7d..cc1fa45b26 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -574,6 +574,7 @@ public:
static void onRemoveFromAvatar( void* userdata );
static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata );
static void removeItemFromAvatar(LLViewerInventoryItem *item);
+ static void removeAllClothesFromAvatar();
void removeFromAvatar();
protected:
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 46a21066ba..620c700077 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7423,7 +7423,7 @@ class LLEditTakeOff : public view_listener_t
{
std::string clothing = userdata.asString();
if (clothing == "all")
- LLAgentWearables::userRemoveAllClothes();
+ LLWearableBridge::removeAllClothesFromAvatar();
else
{
EWearableType type = LLWearableDictionary::typeNameToType(clothing);