summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatarself.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-10-16 21:41:31 +0000
committerLoren Shih <seraph@lindenlab.com>2009-10-16 21:41:31 +0000
commit89d92267e233bc34fe600a07f485266e7edb2879 (patch)
tree6b70df4f746b15024f3956c0dc9cb5fa5233f606 /indra/newview/llvoavatarself.cpp
parentfbddb3163824d44cfb2ceee7127ac9ed2874acab (diff)
svn merge -r134817:136516 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/avatar-pipeline-multiattachments-3 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3
For DEV-32867 : Avatar Pipeline Project - Multi-Attachments This is a viewer-side-only, infrastructure-only merge for multi-attachments. This should not lead to any new functionality; it simply provides backwards compatibility for when multi-attachments are enabled in viewer2.1, so that viewer2.0 users can see viewer2.1 avatars correctly. Reviewed by: Vir.
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rw-r--r--indra/newview/llvoavatarself.cpp40
1 files changed, 23 insertions, 17 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 457c6fe93e..03f9bd4b7c 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -976,7 +976,7 @@ BOOL LLVOAvatarSelf::isWearingAttachment( const LLUUID& inv_item_id , BOOL inclu
{
attachment_map_t::const_iterator curiter = iter++;
const LLViewerJointAttachment* attachment = curiter->second;
- if( attachment->getItemID() == inv_item_id )
+ if (attachment->getAttachedObject(inv_item_id))
{
return TRUE;
}
@@ -997,7 +997,7 @@ BOOL LLVOAvatarSelf::isWearingAttachment( const LLUUID& inv_item_id , BOOL inclu
{
attachment_map_t::const_iterator curiter = iter++;
const LLViewerJointAttachment* attachment = curiter->second;
- if( attachment->getItemID() == item_id )
+ if (attachment->getAttachedObject(item_id))
{
return TRUE;
}
@@ -1011,16 +1011,16 @@ BOOL LLVOAvatarSelf::isWearingAttachment( const LLUUID& inv_item_id , BOOL inclu
//-----------------------------------------------------------------------------
// getWornAttachment()
//-----------------------------------------------------------------------------
-LLViewerObject* LLVOAvatarSelf::getWornAttachment( const LLUUID& inv_item_id ) const
+LLViewerObject* LLVOAvatarSelf::getWornAttachment( const LLUUID& inv_item_id )
{
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end(); )
{
- attachment_map_t::const_iterator curiter = iter++;
- const LLViewerJointAttachment* attachment = curiter->second;
- if( attachment->getItemID() == inv_item_id )
+ attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ if (LLViewerObject *attached_object = attachment->getAttachedObject(inv_item_id))
{
- return attachment->getObject();
+ return attached_object;
}
}
return NULL;
@@ -1033,7 +1033,7 @@ const std::string LLVOAvatarSelf::getAttachedPointName(const LLUUID& inv_item_id
{
attachment_map_t::const_iterator curiter = iter++;
const LLViewerJointAttachment* attachment = curiter->second;
- if( attachment->getItemID() == inv_item_id )
+ if (attachment->getAttachedObject(inv_item_id))
{
return attachment->getName();
}
@@ -1043,9 +1043,9 @@ const std::string LLVOAvatarSelf::getAttachedPointName(const LLUUID& inv_item_id
}
//virtual
-LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *viewer_object)
+const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *viewer_object)
{
- LLViewerJointAttachment *attachment = LLVOAvatar::attachObject(viewer_object);
+ const LLViewerJointAttachment *attachment = LLVOAvatar::attachObject(viewer_object);
if (!attachment)
{
return 0;
@@ -1054,14 +1054,20 @@ LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *viewer_obj
updateAttachmentVisibility(gAgent.getCameraMode());
// Then make sure the inventory is in sync with the avatar.
- LLViewerInventoryItem *item = gInventory.getItem(attachment->getItemID());
- if (item)
- {
- LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:");
- LLAppearanceManager::wearItem(item,false); // Add COF link for item.
+ // Should just be the last object added
+ if (attachment->isObjectAttached(viewer_object))
+ {
+ const LLUUID& attachment_id = viewer_object->getItemID();
+ LLViewerInventoryItem *item = gInventory.getItem(attachment_id);
+ if (item)
+ {
+ LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:");
+ LLAppearanceManager::wearItem(item,false); // Add COF link for item.
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, attachment_id);
+ }
}
- gInventory.addChangedMask(LLInventoryObserver::LABEL, attachment->getItemID());
+
gInventory.notifyObservers();
return attachment;