summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-08-15 22:22:31 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-08-15 22:22:31 +0300
commit73025e27719927ec72eddc6e111ae782b1faf0ae (patch)
treeb13e8cf02c96b8eb509d22eadb912e6424425d7c
parentb21e63cc1260b1b8db87f52fb9b7a2f80b055327 (diff)
STORM-1041 FIXED "Remove all clothes" item of the avatar menu didn't actually remove all clothes.
I haven't investigated what the problem was, I've just rewritten the (ancient?) removal code in the way we take off items in other places, i.e. by removing them from the Current Outfit forder.
-rw-r--r--indra/newview/llagentwearables.cpp31
-rw-r--r--indra/newview/llagentwearables.h2
-rw-r--r--indra/newview/llinventorybridge.cpp39
3 files changed, 15 insertions, 57 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 36272f0c7c..b9125ec8d3 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1692,37 +1692,6 @@ void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &ty
}
}
-// static
-void LLAgentWearables::userRemoveAllClothes()
-{
- // We have to do this up front to avoid having to deal with the case of multiple wearables being dirty.
- if (gAgentCamera.cameraCustomizeAvatar())
- {
- // switching to outfit editor should automagically save any currently edited wearable
- LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
- }
- userRemoveAllClothesStep2(TRUE);
-}
-
-// static
-void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed)
-{
- if (proceed)
- {
- gAgentWearables.removeWearable(LLWearableType::WT_SHIRT,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_PANTS,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_SHOES,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_SOCKS,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_JACKET,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_GLOVES,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_UNDERSHIRT,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_UNDERPANTS,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_SKIRT,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_ALPHA,true,0);
- gAgentWearables.removeWearable(LLWearableType::WT_TATTOO,true,0);
- }
-}
-
// Combines userRemoveAllAttachments() and userAttachMultipleAttachments() logic to
// get attachments into desired state with minimal number of adds/removes.
void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array)
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 3ef50f14da..252b812c27 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -165,7 +165,6 @@ private:
void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
protected:
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
- static void userRemoveAllClothesStep2(BOOL proceed); // userdata is NULL
//--------------------------------------------------------------------
// Server Communication
@@ -211,7 +210,6 @@ public:
public:
static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index);
static void userRemoveWearablesOfType(const LLWearableType::EType &type);
- static void userRemoveAllClothes();
typedef std::vector<LLViewerObject*> llvo_vec_t;
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index ff328fd071..f0fc710f3d 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4925,31 +4925,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