From 7447da6943842a5af31787b2bbee3255b45ba88e Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Thu, 27 Oct 2016 09:39:39 -0400
Subject: [PATCH] SL-503 - more info in archetype dump files

---
 indra/llcharacter/lljoint.cpp | 28 ++++++++++++++++++++++++++++
 indra/llcharacter/lljoint.h   |  5 +++++
 indra/newview/llvoavatar.cpp  | 24 +++++++++++++++---------
 indra/newview/llvovolume.cpp  |  2 +-
 4 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 8d101ff1fcc..6ea2953e895 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -514,6 +514,34 @@ void LLJoint::clearAttachmentPosOverrides()
 	}
 }
 
+//--------------------------------------------------------------------
+// getAllAttachmentPosOverrides()
+//--------------------------------------------------------------------
+void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
+                                           std::set<LLVector3>& distinct_pos_overrides)
+{
+    num_pos_overrides = m_attachmentPosOverrides.count();
+    LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
+    for (; it != m_attachmentPosOverrides.getMap().end(); ++it)
+    {
+        distinct_pos_overrides.insert(it->second);
+    }
+}
+                                        
+//--------------------------------------------------------------------
+// getAllAttachmentScaleOverrides()
+//--------------------------------------------------------------------
+void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides,
+                                             std::set<LLVector3>& distinct_scale_overrides)
+{
+    num_scale_overrides = m_attachmentScaleOverrides.count();
+    LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
+    for (; it != m_attachmentScaleOverrides.getMap().end(); ++it)
+    {
+        distinct_scale_overrides.insert(it->second);
+    }
+}
+                                        
 //--------------------------------------------------------------------
 // showAttachmentPosOverrides()
 //--------------------------------------------------------------------
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 42c2c6f1adc..b2df90dc928 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -278,6 +278,11 @@ class LLJoint
 	void clearAttachmentScaleOverrides();
     void showAttachmentScaleOverrides(const std::string& av_info) const;
 
+    void getAllAttachmentPosOverrides(S32& num_pos_overrides,
+                                      std::set<LLVector3>& distinct_pos_overrides);
+    void getAllAttachmentScaleOverrides(S32& num_scale_overrides,
+                                        std::set<LLVector3>& distinct_scale_overrides);
+    
     // 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;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index d7d6d875f67..ec903211396 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7684,12 +7684,10 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value)
 		wtype = vparam->getWearableType();
 	}
 	S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight());
-	apr_file_printf(file, "\t\t<param id=\"%d\" name=\"%s\" value=\"%.3f\" u8=\"%d\" type=\"%s\" wearable=\"%s\" group=\"%d\"/>\n",
-					viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(),
+	apr_file_printf(file, "\t\t<param id=\"%d\" name=\"%s\" display=\"%s\" value=\"%.3f\" u8=\"%d\" type=\"%s\" wearable=\"%s\" group=\"%d\"/>\n",
+					viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getDisplayName().c_str(), value, u8_value, type_string.c_str(),
 					LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str(),
-					viewer_param->getGroup()
-//					param_location_name(vparam->getParamLocation()).c_str()
-		);
+					viewer_param->getGroup());
 	}
 	
 
@@ -8554,8 +8552,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
 
 			if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
 			{
-				apr_file_printf( file, "\t\t<joint_offset name=\"%s\" position=\"%f %f %f\" mesh_id=\"%s\"/>\n", 
-								 pJoint->getName().c_str(), pos[0], pos[1], pos[2], mesh_id.asString().c_str());
+                S32 num_pos_overrides;
+                std::set<LLVector3> distinct_pos_overrides;
+                pJoint->getAllAttachmentPosOverrides(num_pos_overrides, distinct_pos_overrides);
+				apr_file_printf( file, "\t\t<joint_offset name=\"%s\" position=\"%f %f %f\" mesh_id=\"%s\" count=\"%d\" distinct=\"%d\"/>\n", 
+								 pJoint->getName().c_str(), pos[0], pos[1], pos[2], mesh_id.asString().c_str(),
+                                 num_pos_overrides, distinct_pos_overrides.size());
 			}
 		}
         // Joint scale overrides
@@ -8569,8 +8571,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
 
 			if (pJoint && pJoint->hasAttachmentScaleOverride(scale,mesh_id))
 			{
-				apr_file_printf( file, "\t\t<joint_scale name=\"%s\" scale=\"%f %f %f\" mesh_id=\"%s\"/>\n", 
-								 pJoint->getName().c_str(), scale[0], scale[1], scale[2], mesh_id.asString().c_str());
+                S32 num_scale_overrides;
+                std::set<LLVector3> distinct_scale_overrides;
+                pJoint->getAllAttachmentPosOverrides(num_scale_overrides, distinct_scale_overrides);
+				apr_file_printf( file, "\t\t<joint_scale name=\"%s\" scale=\"%f %f %f\" mesh_id=\"%s\" count=\"%d\" distinct=\"%d\"/>\n",
+								 pJoint->getName().c_str(), scale[0], scale[1], scale[2], mesh_id.asString().c_str(),
+                                 num_scale_overrides, distinct_scale_overrides.size());
 			}
 		}
 		F32 pelvis_fixup;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index d9877d6deff..5b3354a4720 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4779,7 +4779,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
             if (rigged && pAvatarVO)
             {
                 pAvatarVO->addAttachmentOverridesForObject(vobj);
-                if (debugLoggingEnabled("AvatarAttachments") && pAvatarVO->isSelf())
+				if (!LLApp::isExiting() && pAvatarVO->isSelf() && debugLoggingEnabled("AvatarAttachments"))
                 {
                     bool verbose = true;
 					pAvatarVO->showAttachmentOverrides(verbose);
-- 
GitLab