SL-10236 The "Attach To", "Attach To HUD", and "Wear" options aren't greyed out

meow-7.2.2
andreykproductengine 2018-12-13 20:01:01 +02:00
parent bf2efcf43e
commit 514e4f661b
3 changed files with 29 additions and 15 deletions

View File

@ -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);

View File

@ -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()

View File

@ -7068,6 +7068,10 @@ BOOL object_selected_and_point_valid()
BOOL object_is_wearable()
{
if (!isAgentAvatarValid())
{
return FALSE;
}
if (!object_selected_and_point_valid())
{
return FALSE;
@ -7076,17 +7080,7 @@ BOOL object_is_wearable()
{
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++)
{
LLSelectNode* node = *iter;
if (node->mPermissions->getOwner() == gAgent.getID())
{
return TRUE;
}
}
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));