From b1838f02bc6c4a052c68fc6bbf3106e3a796a1a2 Mon Sep 17 00:00:00 2001
From: Nyx Linden <nyx@lindenlab.com>
Date: Fri, 25 Oct 2013 16:43:36 -0400
Subject: [PATCH] SH-4572 FIX changing clothing parameters do not take effect
 in edit appearance

fix, new back-end utility and restoring the necessary functionality.
---
 autobuild.xml                           |  4 ++--
 indra/llappearance/llavatarappearance.h |  7 +++++++
 indra/llappearance/lltexglobalcolor.cpp |  5 +++++
 indra/llappearance/lltexglobalcolor.h   |  2 ++
 indra/llappearance/lltexlayerparams.cpp | 19 +++++++++++++++++++
 5 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/autobuild.xml b/autobuild.xml
index 1ea76edd7fa..599dd1e53b3 100755
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1290,9 +1290,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>bda18a1f808eb248d69ff14fa2c69862</string>
+              <string>43826f8f0a5ce5bcdbfed9ea0b6f4ebb</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/282464/arch/Linux/installer/llappearanceutility_source-0.1-linux-20131016.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/283022/arch/Linux/installer/llappearanceutility_source-0.1-linux-20131025.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 1c212873f4b..1e898026c03 100755
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -219,6 +219,12 @@ class LLAvatarAppearance : public LLCharacter
  **                                                                            **
  *******************************************************************************/
 
+	//--------------------------------------------------------------------
+	// Composites
+	//--------------------------------------------------------------------
+public:
+	virtual void	invalidateComposite(LLTexLayerSet* layerset) = 0;
+
 /********************************************************************************
  **                                                                            **
  **                    MESHES
@@ -257,6 +263,7 @@ class LLAvatarAppearance : public LLCharacter
 	//--------------------------------------------------------------------
 public:
 	LLColor4		getGlobalColor(const std::string& color_name ) const;
+	virtual void	onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0;
 protected:
 	LLTexGlobalColor* mTexSkinColor;
 	LLTexGlobalColor* mTexHairColor;
diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp
index 0e77b29cced..432e2e9f496 100755
--- a/indra/llappearance/lltexglobalcolor.cpp
+++ b/indra/llappearance/lltexglobalcolor.cpp
@@ -103,6 +103,11 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
 	return new_param;
 }
 
+void LLTexParamGlobalColor::onGlobalColorChanged()
+{
+	mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor);
+}
+
 //-----------------------------------------------------------------------------
 // LLTexGlobalColorInfo
 //-----------------------------------------------------------------------------
diff --git a/indra/llappearance/lltexglobalcolor.h b/indra/llappearance/lltexglobalcolor.h
index 02ba14a9598..1b0c91b5cad 100755
--- a/indra/llappearance/lltexglobalcolor.h
+++ b/indra/llappearance/lltexglobalcolor.h
@@ -74,6 +74,8 @@ class LLTexParamGlobalColor : public LLTexLayerParamColor
 public:
 	LLTexParamGlobalColor(LLTexGlobalColor *tex_color);
 	/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
+protected:
+	/*virtual*/ void onGlobalColorChanged();
 private:
 	LLTexGlobalColor*		mTexGlobalColor;
 };
diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp
index 36147f01e0d..9608e2d3914 100755
--- a/indra/llappearance/lltexlayerparams.cpp
+++ b/indra/llappearance/lltexlayerparams.cpp
@@ -178,6 +178,7 @@ void LLTexLayerParamAlpha::setWeight(F32 weight)
 		if ((mAvatarAppearance->getSex() & getSex()) &&
 			(mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
 		{
+			mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
 			mTexLayer->invalidateMorphMasks();
 		}
 	}
@@ -464,6 +465,24 @@ void LLTexLayerParamColor::setWeight(F32 weight)
 	if (cur_u8 != new_u8)
 	{
 		mCurWeight = new_weight;
+
+                const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
+
+		if (info->mNumColors <= 0)
+		{
+			// This will happen when we set the default weight the first time.
+			return;
+		}
+
+		if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
+		{
+			onGlobalColorChanged();
+			if (mTexLayer)
+			{
+				mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet());
+			}
+		}
+
 //		llinfos << "param " << mName << " = " << new_weight << llendl;
 	}
 }
-- 
GitLab