summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatarself.cpp
diff options
context:
space:
mode:
authorprep linden <prep@lindenlab.com>2010-10-05 14:14:37 -0400
committerprep linden <prep@lindenlab.com>2010-10-05 14:14:37 -0400
commit70b2ace13130b3a0d881fb87cff0167ed811f560 (patch)
treec9360245f9757c6c2698d40fbd8db4e1efe74ddb /indra/newview/llvoavatarself.cpp
parent7be98bc20f53d6c418e01842da89c62c4002991d (diff)
Reset joint positions after detaching a rigged model
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rw-r--r--indra/newview/llvoavatarself.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index fd519cb3a9..0298bcc80b 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -62,6 +62,8 @@
#include "llviewerstats.h"
#include "llviewerregion.h"
#include "llappearancemgr.h"
+#include "llmeshrepository.h"
+#include "llvovolume.h"
#if LL_MSVC
// disable boost::lexical_cast warning
@@ -655,6 +657,10 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
return LLVOAvatar::getJoint(name);
}
+void LLVOAvatarSelf::resetJointPositions( void )
+{
+ return LLVOAvatar::resetJointPositionsToDefault();
+}
// virtual
BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake )
{
@@ -1119,8 +1125,22 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
{
const LLUUID attachment_id = viewer_object->getAttachmentItemID();
- if (LLVOAvatar::detachObject(viewer_object))
+ if ( LLVOAvatar::detachObject(viewer_object) )
{
+ //If a VO has a skin that we'll reset the joint positions to their default
+ if ( viewer_object->mDrawable )
+ {
+ LLVOVolume* pVObj = viewer_object->mDrawable->getVOVolume();
+ if ( pVObj )
+ {
+ const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( pVObj->getVolume()->getParams().getSculptID() );
+ if ( pSkinData )
+ {
+ resetJointPositions();
+ }
+ }
+ }
+
// the simulator should automatically handle permission revocation
stopMotionFromSource(attachment_id);