EXT-3527 : Centralize calls to getIsItemWorn
Moved function from llinventorybridge to llinventoryfunctions. --HG-- branch : avatar-pipelinemeow-7.2.2
parent
66e7ca7c7a
commit
7796fc6748
|
|
@ -506,41 +506,6 @@ 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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Helper for commonly-used entries
|
||||
void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
|
||||
std::vector<std::string> &items,
|
||||
|
|
@ -552,7 +517,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
|
|||
if (is_sidepanel)
|
||||
{
|
||||
// Sidepanel includes restricted menu.
|
||||
if (obj && obj->getIsLinkType() && !isWornLink(mUUID))
|
||||
if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
|
||||
{
|
||||
items.push_back(std::string("Remove Link"));
|
||||
}
|
||||
|
|
@ -617,7 +582,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
|
|||
items.push_back(std::string("Paste Separator"));
|
||||
|
||||
|
||||
if (obj && obj->getIsLinkType() && !isWornLink(mUUID))
|
||||
if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
|
||||
{
|
||||
items.push_back(std::string("Remove Link"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -338,3 +338,33 @@ LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
|
|||
const std::string& icon_name = get_item_icon_name(asset_type, inventory_type, attachment_point, item_is_multi );
|
||||
return LLUI::getUIImage(icon_name);
|
||||
}
|
||||
|
||||
BOOL get_is_item_worn(const LLUUID& id)
|
||||
{
|
||||
const LLViewerInventoryItem* item = gInventory.getItem(id);
|
||||
if (!item)
|
||||
return FALSE;
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
case LLAssetType::AT_OBJECT:
|
||||
{
|
||||
const LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
|
||||
if(my_avatar && my_avatar->isWearingAttachment(item->getLinkedUUID()))
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
|
||||
return TRUE;
|
||||
break;
|
||||
case LLAssetType::AT_GESTURE:
|
||||
if (LLGestureManager::instance().isGestureActive(item->getLinkedUUID()))
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@
|
|||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// This is a collection of miscellaneous functions and classes
|
||||
// that don't fit cleanly into any other class header.
|
||||
// that don't fit cleanly into any other class header. Eventually,
|
||||
// we should figure out where to put these functions so that we can
|
||||
// get rid of this generic file.
|
||||
//
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
@ -98,14 +100,17 @@ public:
|
|||
};
|
||||
|
||||
const std::string& get_item_icon_name(LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType inventory_type,
|
||||
U32 attachment_point,
|
||||
BOOL item_is_multi );
|
||||
LLInventoryType::EType inventory_type,
|
||||
U32 attachment_point,
|
||||
BOOL item_is_multi );
|
||||
|
||||
LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType inventory_type,
|
||||
U32 attachment_point,
|
||||
BOOL item_is_multi );
|
||||
LLInventoryType::EType inventory_type,
|
||||
U32 attachment_point,
|
||||
BOOL item_is_multi );
|
||||
|
||||
// Is it worn, attached, etc...
|
||||
BOOL get_is_item_worn(const LLUUID& id);
|
||||
|
||||
#endif // LL_LLINVENTORYFUNCTIONS_H
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue