From fc84d684500c2216aa270bffef865ee265927535 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 10 Sep 2012 18:46:52 -0400
Subject: [PATCH] dumpArchetypeXML tweaks, appearance debugging

---
 indra/newview/llvoavatar.cpp     | 41 ++++++++++++++++----------------
 indra/newview/llvoavatar.h       |  2 +-
 indra/newview/llvoavatarself.cpp |  1 +
 indra/newview/llwearable.cpp     |  6 +++++
 4 files changed, 28 insertions(+), 22 deletions(-)
 mode change 100644 => 100755 indra/newview/llwearable.cpp

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index e03c0c3dad9..61816c1771c 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7337,6 +7337,7 @@ bool LLVOAvatar::visualParamWeightsAreDefault()
 //-----------------------------------------------------------------------------
 void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 {
+	dumpArchetypeXML("process_start");
 	if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages"))
 	{
 		llwarns << "Blocking AvatarAppearance message" << llendl;
@@ -7773,32 +7774,30 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
 	dirtyMesh();
 }
 
-void LLVOAvatar::dumpArchetypeXML(const std::string& filename )
+void LLVOAvatar::dumpArchetypeXML(const std::string& prefix )
 {
-	std::string outfilename(filename);
-	if (outfilename.empty())
+	std::string outprefix(prefix);
+	if (outprefix.empty())
 	{
-		std::string fullname = getFullname();
-		if (!fullname.empty())
-		{
-			typedef std::map<std::string,S32> file_num_type;
-			static  file_num_type file_nums;
-			file_num_type::iterator it = file_nums.find(fullname);
-			S32 num = 0;
-			if (it != file_nums.end())
-			{
-				num = it->second;
-			}
-			std::ostringstream temp;
-			temp << std::setw(4) << std::setfill('0') << num;
-			file_nums[fullname] = num+1;
-			outfilename = fullname + " " + temp.str() + ".xml";
-		}
+		outprefix = getFullname();
+	}
+	if (outprefix.empty())
+	{
+		outprefix = std::string("new_archetype");
 	}
-	if (outfilename.empty())
+	typedef std::map<std::string,S32> file_num_type;
+	static  file_num_type file_nums;
+	file_num_type::iterator it = file_nums.find(outprefix);
+	S32 num = 0;
+	if (it != file_nums.end())
 	{
-		outfilename = std::string("new archetype.xml");
+		num = it->second;
 	}
+	std::ostringstream temp;
+	temp << std::setw(4) << std::setfill('0') << num;
+	file_nums[outprefix] = num+1;
+	std::string outfilename = outprefix + " " + temp.str() + ".xml";
+	std::replace(outfilename.begin(),outfilename.end(),' ','_');
 	
 	LLAPRFile outfile;
 	outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB );
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 5ec20099717..62c8e680693 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -1016,7 +1016,7 @@ class LLVOAvatar :
 	// General
 	//--------------------------------------------------------------------
 public:
-	void				dumpArchetypeXML(const std::string& filename);
+	void				dumpArchetypeXML(const std::string& prefix);
 	static void			dumpBakedStatus();
 	const std::string 	getBakedStatusForPrintout() const;
 	void				dumpAvatarTEs(const std::string& context) const;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 6c8cbc37f76..87910556958 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -2706,6 +2706,7 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch)
 			gAgentCamera.changeCameraToCustomizeAvatar();
 		}
 
+		gAgentAvatarp->clearVisualParamWeights();
 		gAgentAvatarp->invalidateAll();
 		gAgentAvatarp->updateMeshTextures();
 	}
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
old mode 100644
new mode 100755
index 402504933cd..3f07d6877c7
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -619,6 +619,12 @@ void LLWearable::setTexturesToDefaults()
 void LLWearable::writeToAvatar()
 {
 	if (!isAgentAvatarValid()) return;
+#if 0
+	if (!gAgentAvatarp->isUsingLocalAppearance())
+	{
+		return;
+	}
+#endif
 
 	ESex old_sex = gAgentAvatarp->getSex();
 
-- 
GitLab