summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatarself.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-08-13 11:12:51 -0400
committerLoren Shih <seraph@lindenlab.com>2010-08-13 11:12:51 -0400
commit2f77724a48b51a97091a0e27f20767cfb14e78e5 (patch)
tree0fb2b6371c1edef5d63cc68fc5e3ec1fe4a622ef /indra/newview/llvoavatarself.cpp
parentb241d9769cf5ef21fa90e38ad21c2c4d49aab6f3 (diff)
EXT-8650 Can wear multiple copies of no-copy item via object links
* EXT-8688 Automatically detach same object is detected * EXT-8689 Cleanup detachAttachmentIntoInventory code When an object arrives as an attachment, if it's already attached then it's automatically detached.
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rw-r--r--indra/newview/llvoavatarself.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index bddde08ca9..09e50dcb90 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1067,7 +1067,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
// Should just be the last object added
if (attachment->isObjectAttached(viewer_object))
{
- const LLUUID& attachment_id = viewer_object->getItemID();
+ const LLUUID& attachment_id = viewer_object->getAttachmentItemID();
LLAppearanceMgr::instance().registerAttachment(attachment_id);
}
@@ -1077,7 +1077,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
//virtual
BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
{
- const LLUUID attachment_id = viewer_object->getItemID();
+ const LLUUID attachment_id = viewer_object->getAttachmentItemID();
if (LLVOAvatar::detachObject(viewer_object))
{
// the simulator should automatically handle permission revocation
@@ -1115,6 +1115,29 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
return FALSE;
}
+// static
+BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id)
+{
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (item)
+ {
+ gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_id);
+ gMessageSystem->sendReliable(gAgent.getRegion()->getHost());
+
+ // this object might have been selected, so let the selection manager know it's gone now
+ LLViewerObject *found_obj = gObjectList.findObject(item_id);
+ if (found_obj)
+ {
+ LLSelectMgr::getInstance()->remove(found_obj);
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
U32 LLVOAvatarSelf::getNumWearables(LLVOAvatarDefines::ETextureIndex i) const
{
LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
@@ -1625,15 +1648,15 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
if (isSelf())
{
if (gAgentAvatarp->isUsingBakedTextures())
- {
- requestLayerSetUpdate(type);
- }
+ {
+ requestLayerSetUpdate(type);
+ }
else
- {
- LLVisualParamHint::requestHintUpdates();
+ {
+ LLVisualParamHint::requestHintUpdates();
+ }
}
}
- }
else
{
tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL);