From 041433483ad64c399ffcdf95906eb8e83109ba75 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Tue, 26 Apr 2016 17:07:04 -0400
Subject: [PATCH] SL-375 - tolerance and debug output tweaks

---
 indra/newview/llvoavatar.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index e6df4f4fd12..9bfb402b03a 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5315,6 +5315,13 @@ void LLVOAvatar::clearAttachmentPosOverrides()
 	}
 }
 
+bool above_joint_pos_threshold(const LLVector3& diff)
+{
+    return !diff.isNull();
+    //const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm
+    //return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset;
+}
+
 //-----------------------------------------------------------------------------
 // addAttachmentPosOverridesForObject
 //-----------------------------------------------------------------------------
@@ -5375,7 +5382,7 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)
 					{   									
 						pJoint->setId( currentId );
 						const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();									
-                        if ((jointPos-pJoint->getDefaultPosition()).isNull())
+                        if (!above_joint_pos_threshold(jointPos-pJoint->getDefaultPosition()))
                         {
                             LL_DEBUGS("Avatar") << "Attachment pos override ignored for " << pJoint->getName()
                                                 << ", pos " << jointPos << " is same as default pos" << LL_ENDL;
@@ -5408,7 +5415,10 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)
 		postPelvisSetRecalc();
 	}		
 
-    showAttachmentPosOverrides();
+    if (isSelf())
+    {
+        showAttachmentPosOverrides();
+    }
 }
 
 //-----------------------------------------------------------------------------
-- 
GitLab