DEV-52580 FIX
parent
6c1796c105
commit
37a0124bfd
|
|
@ -4000,8 +4000,17 @@ std::string LLObjectBridge::getLabelSuffix() const
|
|||
|
||||
void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment)
|
||||
{
|
||||
LLSD payload;
|
||||
payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
|
||||
const LLUUID& item_id = item->getLinkedUUID();
|
||||
|
||||
// Check for duplicate request.
|
||||
if (isAgentAvatarValid() &&
|
||||
(gAgentAvatarp->attachmentWasRequested(item_id) ||
|
||||
gAgentAvatarp->isWearingAttachment(item_id)))
|
||||
{
|
||||
llwarns << "duplicate attachment request, ignoring" << llendl;
|
||||
return;
|
||||
}
|
||||
gAgentAvatarp->addAttachmentRequest(item_id);
|
||||
|
||||
S32 attach_pt = 0;
|
||||
if (isAgentAvatarValid() && attachment)
|
||||
|
|
@ -4017,6 +4026,8 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
|
|||
}
|
||||
}
|
||||
|
||||
LLSD payload;
|
||||
payload["item_id"] = item_id; // Wear the base object in case this is a link.
|
||||
payload["attachment_point"] = attach_pt;
|
||||
|
||||
if (!gSavedSettings.getBOOL("MultipleAttachments") &&
|
||||
|
|
@ -4043,11 +4054,13 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
|
|||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
if (option == 0/*YES*/)
|
||||
{
|
||||
LLViewerInventoryItem* itemp = gInventory.getItem(notification["payload"]["item_id"].asUUID());
|
||||
LLUUID item_id = notification["payload"]["item_id"].asUUID();
|
||||
LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
|
||||
|
||||
if (itemp)
|
||||
{
|
||||
U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
|
||||
|
||||
if (gSavedSettings.getBOOL("MultipleAttachments"))
|
||||
attachment_pt |= ATTACHMENT_ADD;
|
||||
|
||||
|
|
|
|||
|
|
@ -1015,6 +1015,44 @@ BOOL LLVOAvatarSelf::isWearingAttachment(const LLUUID& inv_item_id) const
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLVOAvatarSelf::attachmentWasRequested(const LLUUID& inv_item_id) const
|
||||
{
|
||||
const F32 REQUEST_EXPIRATION_SECONDS = 5.0; // any request older than this is ignored/removed.
|
||||
std::map<LLUUID,LLTimer>::iterator it = mAttachmentRequests.find(inv_item_id);
|
||||
if (it != mAttachmentRequests.end())
|
||||
{
|
||||
const LLTimer& request_time = it->second;
|
||||
F32 request_time_elapsed = request_time.getElapsedTimeF32();
|
||||
if (request_time_elapsed > REQUEST_EXPIRATION_SECONDS)
|
||||
{
|
||||
mAttachmentRequests.erase(it);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLVOAvatarSelf::addAttachmentRequest(const LLUUID& inv_item_id)
|
||||
{
|
||||
LLTimer current_time;
|
||||
mAttachmentRequests[inv_item_id] = current_time;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLVOAvatarSelf::removeAttachmentRequest(const LLUUID& inv_item_id)
|
||||
{
|
||||
mAttachmentRequests.erase(inv_item_id);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// getWornAttachment()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1069,6 +1107,8 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
|
|||
{
|
||||
const LLUUID& attachment_id = viewer_object->getAttachmentItemID();
|
||||
LLAppearanceMgr::instance().registerAttachment(attachment_id);
|
||||
// Clear any pending requests once the attachment arrives.
|
||||
removeAttachmentRequest(attachment_id);
|
||||
}
|
||||
|
||||
return attachment;
|
||||
|
|
|
|||
|
|
@ -291,11 +291,18 @@ protected:
|
|||
public:
|
||||
void updateAttachmentVisibility(U32 camera_mode);
|
||||
BOOL isWearingAttachment(const LLUUID& inv_item_id) const;
|
||||
BOOL attachmentWasRequested(const LLUUID& inv_item_id) const;
|
||||
void addAttachmentRequest(const LLUUID& inv_item_id);
|
||||
void removeAttachmentRequest(const LLUUID& inv_item_id);
|
||||
LLViewerObject* getWornAttachment(const LLUUID& inv_item_id);
|
||||
const std::string getAttachedPointName(const LLUUID& inv_item_id) const;
|
||||
/*virtual*/ const LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object);
|
||||
/*virtual*/ BOOL detachObject(LLViewerObject *viewer_object);
|
||||
|
||||
private:
|
||||
// Track attachments that have been requested but have not arrived yet.
|
||||
mutable std::map<LLUUID,LLTimer> mAttachmentRequests;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// HUDs
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue