summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitslist.cpp
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-12-13 20:01:01 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-12-13 20:01:01 +0200
commit514e4f661bbf4355ead4e60288c0075cc945b597 (patch)
treed78b928db78180eff9dcb59a5ab94dc8fddfea5a /indra/newview/lloutfitslist.cpp
parentbf2efcf43e5efaf91220a0c77f3db792636edeb1 (diff)
SL-10236 The "Attach To", "Attach To HUD", and "Wear" options aren't greyed out
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r--indra/newview/lloutfitslist.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 892fa385d7..f2a284a561 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -621,8 +621,14 @@ void LLOutfitsList::applyFilterToTab(
bool LLOutfitsList::canWearSelected()
{
+ if (!isAgentAvatarValid())
+ {
+ return false;
+ }
+
uuid_vec_t selected_items;
getSelectedItemsUUIDs(selected_items);
+ S32 nonreplacable_objects = 0;
for (uuid_vec_t::const_iterator it = selected_items.begin(); it != selected_items.end(); ++it)
{
@@ -633,10 +639,21 @@ bool LLOutfitsList::canWearSelected()
{
return false;
}
+
+ const LLViewerInventoryItem* item = gInventory.getItem(id);
+ if (!item)
+ {
+ return false;
+ }
+
+ if (item->getType() == LLAssetType::AT_OBJECT)
+ {
+ nonreplacable_objects++;
+ }
}
- // All selected items can be worn.
- return true;
+ // All selected items can be worn. But do we have enough space for them?
+ return nonreplacable_objects == 0 || gAgentAvatarp->canAttachMoreObjects(nonreplacable_objects);
}
void LLOutfitsList::wearSelectedItems()