diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-12-10 19:35:58 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-12-10 19:35:58 -0500 |
commit | 264446a5ce3739ab186b9fbdfc81847590404c86 (patch) | |
tree | dfae8459c6146b4a10462db413c879cab7e3762b /indra/newview | |
parent | b131314dba9e50b260e30ebd3f3bbeb626563a9c (diff) |
For EXT-2858: Determine gear menu / right-click menu choices for AppearanceSP
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 68 |
1 files changed, 53 insertions, 15 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 56d3745309..0ec019c4f9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -506,12 +506,57 @@ void hide_context_entries(LLMenuGL& menu, } } +bool isWornLink(LLUUID link_id) +{ + LLViewerInventoryItem *link = gInventory.getItem(link_id); + if (!link) + return false; + LLViewerInventoryItem *item = link->getLinkedItem(); + if (!item) + return false; + + switch(item->getType()) + { + case LLAssetType::AT_OBJECT: + { + LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); + if(my_avatar && my_avatar->isWearingAttachment(item->getUUID())) + return true; + } + break; + + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_CLOTHING: + if(gAgentWearables.isWearingItem(item->getUUID())) + return true; + break; + + case LLAssetType::AT_GESTURE: + if (LLGestureManager::instance().isGestureActive(item->getUUID())) + return true; + break; + } + return false; +} + // Helper for commonly-used entries void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<std::string> &items, std::vector<std::string> &disabled_items, U32 flags) { const LLInventoryObject *obj = getInventoryObject(); + + bool is_sidepanel = isInOutfitsSidePanel(); + if (is_sidepanel) + { + // Sidepanel includes restricted menu. + if (obj && obj->getIsLinkType() && !isWornLink(mUUID)) + { + items.push_back(std::string("Remove Link")); + } + return; + } + if (obj) { if (obj->getIsLinkType()) @@ -567,14 +612,13 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, items.push_back(std::string("Paste Separator")); - if (obj && obj->getIsLinkType()) + if (obj && obj->getIsLinkType() && !isWornLink(mUUID)) { items.push_back(std::string("Remove Link")); } items.push_back(std::string("Delete")); - const bool is_sidepanel = isInOutfitsSidePanel(); - if ((obj && obj->getIsLinkType() && is_sidepanel) || !isItemRemovable()) + if (!isItemRemovable()) { disabled_items.push_back(std::string("Delete")); } @@ -3784,10 +3828,10 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Open")); items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); } + getClipboardEntries(true, items, disabled_items, flags); + items.push_back(std::string("Gesture Separator")); if (LLGestureManager::instance().isGestureActive(getUUID())) { @@ -4115,10 +4159,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Properties")); } - if (!is_sidepanel) - { - getClipboardEntries(true, items, disabled_items, flags); - } + getClipboardEntries(true, items, disabled_items, flags); LLObjectBridge::sContextMenuItemID = mUUID; @@ -4561,15 +4602,10 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Properties")); } - if (!is_sidepanel) - { - getClipboardEntries(true, items, disabled_items, flags); - } + getClipboardEntries(true, items, disabled_items, flags); items.push_back(std::string("Wearable Separator")); - items.push_back(std::string("Wearable Wear")); - items.push_back(std::string("Wearable Add")); items.push_back(std::string("Wearable Edit")); if ((flags & FIRST_SELECTED_ITEM) == 0) @@ -4599,6 +4635,8 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else { + items.push_back(std::string("Wearable Wear")); + items.push_back(std::string("Wearable Add")); disabled_items.push_back(std::string("Take Off")); } break; |