diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-17 11:41:12 -0700 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-17 11:41:12 -0700 |
commit | 738dde2053479696ac0b4a18996c3046bb55b196 (patch) | |
tree | 52160a99161c58d9330d41ac8dd57be355f332b3 /indra/newview/llviewerjointattachment.cpp | |
parent | 2683006ff4a8325bc884a2861220b08964e7eaad (diff) | |
parent | e43d9e57d652b95a422e3de9d78bc89c547a75ce (diff) |
(final?) hairy merge from viewer-release to viewer-public
Diffstat (limited to 'indra/newview/llviewerjointattachment.cpp')
-rw-r--r-- | indra/newview/llviewerjointattachment.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index da4960b69d..c9335366cd 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -35,12 +35,11 @@ #include "llviewerjointattachment.h" #include "llagentconstants.h" - #include "llviewercontrol.h" #include "lldrawable.h" #include "llgl.h" #include "llrender.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvolume.h" #include "pipeline.h" #include "llspatialpartition.h" @@ -164,6 +163,9 @@ void LLViewerJointAttachment::setupDrawable(LLViewerObject *object) //----------------------------------------------------------------------------- BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { + object->extractAttachmentItemID(); + + // Same object reattached if (isObjectAttached(object)) { llinfos << "(same object re-attached)" << llendl; @@ -171,8 +173,19 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) // Pass through anyway to let setupDrawable() // re-connect object to the joint correctly } + + // Two instances of the same inventory item attached -- + // Request detach, and kill the object in the meantime. + if (getAttachedObject(object->getAttachmentItemID())) + { + llinfos << "(same object re-attached)" << llendl; + object->markDead(); + + // If this happens to be attached to self, then detach. + LLVOAvatarSelf::detachAttachmentIntoInventory(object->getAttachmentItemID()); + return FALSE; + } - object->extractAttachmentItemID(); mAttachedObjects.push_back(object); setupDrawable(object); @@ -195,7 +208,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) } calcLOD(); mUpdateXform = TRUE; - + return TRUE; } |