From 204e474225c652fcd00ffc3de56171594d768afb Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 4 Nov 2016 14:24:03 -0400
Subject: [PATCH] SL-524 - resetSkeleton() now includes collision volume joint
 positions. Also removed no-longer-needed LLJoint::mId field

---
 indra/llcharacter/lljoint.cpp |  2 --
 indra/llcharacter/lljoint.h   |  7 -------
 indra/newview/llvoavatar.cpp  | 34 ++++++----------------------------
 3 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 6ea2953e895..a3d5679f655 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -510,7 +510,6 @@ void LLJoint::clearAttachmentPosOverrides()
 	{
 		m_attachmentPosOverrides.clear();
 		setPosition(m_posBeforeOverrides);
-		setId( LLUUID::null );
 	}
 }
 
@@ -700,7 +699,6 @@ void LLJoint::clearAttachmentScaleOverrides()
 	{
 		m_attachmentScaleOverrides.clear();
 		setScale(m_scaleBeforeOverrides);
-		setId( LLUUID::null );
 	}
 }
 
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index b2df90dc928..0c8fbfebb0e 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -112,8 +112,6 @@ class LLJoint
 	// explicit transformation members
 	LLXformMatrix		mXform;
 
-	LLUUID				mId;
-
     LLVector3       mDefaultPosition;
     LLVector3       mDefaultScale;
     
@@ -286,11 +284,6 @@ class LLJoint
     // These are used in checks of whether a pos/scale override is considered significant.
     bool aboveJointPosThreshold(const LLVector3& pos) const;
     bool aboveJointScaleThreshold(const LLVector3& scale) const;
-    
-	//Accessor for the joint id
-	LLUUID getId( void ) { return mId; }
-	//Setter for the joints id
-	void setId( const LLUUID& id ) { mId = id;}
 };
 #endif // LL_LLJOINT_H
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index fb1bbb21377..cbd941dd402 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1906,7 +1906,6 @@ void LLVOAvatar::resetSkeleton()
     // Reset tweakable params to preserved state
     bool slam_params = true;
     applyParsedAppearanceMessage(*mLastProcessedAppearance, slam_params);
-
     updateVisualParams();
 
     // Restore attachment pos overrides
@@ -5460,32 +5459,13 @@ void LLVOAvatar::clearAttachmentOverrides()
 {
     LLScopedContextString str("clearAttachmentOverrides " + getFullname());
 
-	//Subsequent joints are relative to pelvis
-	avatar_joint_list_t::iterator iter = mSkeleton.begin();
-	avatar_joint_list_t::iterator end  = mSkeleton.end();
-
-	for (; iter != end; ++iter)
-	{
-		LLJoint* pJoint = (*iter);
-		if (pJoint)
-		{
+    for (S32 i=0; i<LL_CHARACTER_MAX_ANIMATED_JOINTS; i++)
+    {
+        LLJoint *pJoint = getJoint(i);
+        if (pJoint)
+        {
 			pJoint->clearAttachmentPosOverrides();
-		}
-		if (pJoint)
-		{
 			pJoint->clearAttachmentScaleOverrides();
-		}
-	}
-
-    // Attachment points
-	for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
-		 iter != mAttachmentPoints.end();
-		 ++iter)
-	{
-		LLViewerJointAttachment *attachment_pt = (*iter).second;
-        if (attachment_pt)
-        {
-            attachment_pt->clearAttachmentPosOverrides();
         }
     }
 }
@@ -5570,9 +5550,8 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo)
 				{
 					std::string lookingForJoint = pSkinData->mJointNames[i].c_str();
 					LLJoint* pJoint = getJoint( lookingForJoint );
-					if ( pJoint && pJoint->getId() != currentId )
+					if (pJoint)
 					{   									
-						pJoint->setId( currentId );
 						const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();									
                         if (pJoint->aboveJointPosThreshold(jointPos))
                         {
@@ -5779,7 +5758,6 @@ void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id)
 		if ( pJoint )
 		{			
             bool dummy; // unused
-			pJoint->setId( LLUUID::null );
 			pJoint->removeAttachmentPosOverride(mesh_id, avString(),dummy);
 			pJoint->removeAttachmentScaleOverride(mesh_id, avString());
 		}		
-- 
GitLab