summaryrefslogtreecommitdiff
path: root/indra
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
parentbf2efcf43e5efaf91220a0c77f3db792636edeb1 (diff)
SL-10236 The "Attach To", "Attach To HUD", and "Wear" options aren't greyed out
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventorybridge.cpp5
-rw-r--r--indra/newview/lloutfitslist.cpp21
-rw-r--r--indra/newview/llviewermenu.cpp18
3 files changed, 29 insertions, 15 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 1987e15850..e7367d5ced 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -7344,7 +7344,10 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ
{
if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids))
{
- disabled_items.push_back(std::string("Wearable Add"));
+ disabled_items.push_back(std::string("Wearable And Object Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
+ disabled_items.push_back(std::string("Attach To"));
+ disabled_items.push_back(std::string("Attach To HUD"));
}
}
disable_context_entries_if_present(menu, disabled_items);
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()
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 6c52f118ad..ba68ce4cf4 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7068,25 +7068,19 @@ BOOL object_selected_and_point_valid()
BOOL object_is_wearable()
{
- if (!object_selected_and_point_valid())
+ if (!isAgentAvatarValid())
{
return FALSE;
}
- if (sitting_on_selection())
+ if (!object_selected_and_point_valid())
{
return FALSE;
}
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
+ if (sitting_on_selection())
{
- LLSelectNode* node = *iter;
- if (node->mPermissions->getOwner() == gAgent.getID())
- {
- return TRUE;
- }
+ return FALSE;
}
- return FALSE;
+ return gAgentAvatarp->canAttachMoreObjects();
}
@@ -9207,7 +9201,7 @@ void initialize_menus()
enable.add("Object.EnableOpen", boost::bind(&enable_object_open));
enable.add("Object.EnableTouch", boost::bind(&enable_object_touch, _1));
enable.add("Object.EnableDelete", boost::bind(&enable_object_delete));
- enable.add("Object.EnableWear", boost::bind(&object_selected_and_point_valid));
+ enable.add("Object.EnableWear", boost::bind(&object_is_wearable));
enable.add("Object.EnableStandUp", boost::bind(&enable_object_stand_up));
enable.add("Object.EnableSit", boost::bind(&enable_object_sit, _1));