summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitslist.cpp
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-06-29 21:55:37 +0300
committerSergei Litovchuk <slitovchuk@productengine.com>2010-06-29 21:55:37 +0300
commit4081f6f5844d4846162727682206440859fd4dc4 (patch)
tree5836cfe4fd51b9720ac9582f66a739c43a51f4b1 /indra/newview/lloutfitslist.cpp
parent167e57d1387931a94b4a55f6c6560b64cef78144 (diff)
EXT-8014 FIXED Enabled "Take off" in My Outfits gear menu if any of selected items can be taken off or selected outfit contains items that can be taken off.
Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/649/. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r--indra/newview/lloutfitslist.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 23c7e64cce..dddfd9106f 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -657,10 +657,10 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
}
if (command_name == "take_off")
{
- // Enable "Take Off" only if a worn item or base outfit is selected.
- return ( !hasItemSelected()
- && LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID )
- || hasWornItemSelected();
+ // Enable "Take Off" if any of selected items can be taken off
+ // or the selected outfit contains items that can be taken off.
+ return ( hasItemSelected() && canTakeOffSelected() )
+ || ( !hasItemSelected() && LLAppearanceMgr::getCanRemoveFromCOF(mSelectedOutfitUUID) );
}
if (command_name == "wear_add")
@@ -955,14 +955,19 @@ void LLOutfitsList::applyFilterToTab(
}
}
-bool LLOutfitsList::hasWornItemSelected()
+bool LLOutfitsList::canTakeOffSelected()
{
uuid_vec_t selected_uuids;
getSelectedItemsUUIDs(selected_uuids);
+ LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
+
for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
{
- if (get_is_item_worn(*it)) return true;
+ LLViewerInventoryItem* item = gInventory.getItem(*it);
+ if (!item) continue;
+
+ if (is_worn(NULL, item)) return true;
}
return false;
}