diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-08-18 18:02:25 +0300 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-08-18 18:02:25 +0300 |
commit | b65bf3f2472be7a29a3704044aac750f00d31050 (patch) | |
tree | 5914a94d95376f1d2a83045788ac7f604a86cb6c /indra/newview/llviewerjointattachment.cpp | |
parent | f083886a003d2360443e4c34c6c1cdc6a1ad329f (diff) | |
parent | b5a8534116a89f79ab3b76cde3880bff5c998eeb (diff) |
Merge from default branch
--HG--
branch : product-engine
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; } |