From 0a94b5bb390675bb1746f24c8352e73240a8d670 Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Fri, 28 Sep 2012 23:56:55 +0000
Subject: [PATCH] Exposing more tex layer information for hash id generation

---
 autobuild.xml                                 |  4 ++--
 .../llappearance/llavatarappearancedefines.h  |  1 +
 indra/llappearance/lltexlayer.cpp             | 20 ++++++++++++++++---
 indra/llappearance/lltexlayer.h               |  4 +++-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/autobuild.xml b/autobuild.xml
index 3ac29320759..adfdfcd3786 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1254,9 +1254,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>84dae3ea3825fa0584ef3de78bcc1632</string>
+              <string>d1475169f4a18423a16d5161426b4ffd</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/265271/arch/Linux/installer/llappearanceutility_source-0.1-linux-20120928.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/265319/arch/Linux/installer/llappearanceutility_source-0.1-linux-20120928.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 0351f284295..2e073bf5d27 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -46,6 +46,7 @@ extern const S32 IMPOSTOR_PERIOD;
 //--------------------------------------------------------------------
 enum ETextureIndex
 {
+	TEX_INVALID = -1,
 	TEX_HEAD_BODYPAINT = 0,
 	TEX_UPPER_SHIRT,
 	TEX_LOWER_PANTS,
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 79d870c61da..6f079b4abbf 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -903,6 +903,21 @@ const std::string& LLTexLayerInterface::getName() const
 	return mInfo->mName; 
 }
 
+ETextureIndex LLTexLayerInterface::getLocalTextureIndex() const
+{
+	return (ETextureIndex) mInfo->mLocalTexture;
+}
+
+LLWearableType::EType LLTexLayerInterface::getWearableType() const
+{
+	ETextureIndex te = getLocalTextureIndex();
+	if (TEX_INVALID == te)
+	{
+		return LLWearableType::WT_INVALID;
+	}
+	return LLAvatarAppearanceDictionary::getTEWearableType(te);
+}
+
 LLTexLayerInterface::ERenderPass LLTexLayerInterface::getRenderPass() const
 {
 	return mInfo->mRenderPass; 
@@ -1585,13 +1600,12 @@ U32 LLTexLayerTemplate::updateWearableCache() const
 {
 	mWearableCache.clear();
 
-	S32 te = mInfo->mLocalTexture;
-	if (te == -1)
+	LLWearableType::EType wearable_type = getWearableType();
+	if (LLWearableType::WT_INVALID == wearable_type)
 	{
 		//this isn't a cloneable layer 
 		return 0;
 	}
-	LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te);
 	U32 num_wearables = getAvatarAppearance()->getWearableData()->getWearableCount(wearable_type);
 	U32 added = 0;
 	for (U32 i = 0; i < num_wearables; i++)
diff --git a/indra/llappearance/lltexlayer.h b/indra/llappearance/lltexlayer.h
index a288d7fc50a..f9f8bdd817c 100644
--- a/indra/llappearance/lltexlayer.h
+++ b/indra/llappearance/lltexlayer.h
@@ -72,6 +72,8 @@ class LLTexLayerInterface
 
 	const LLTexLayerInfo* 	getInfo() const 			{ return mInfo; }
 	virtual BOOL			setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
+	LLWearableType::EType	getWearableType() const;
+	LLAvatarAppearanceDefines::ETextureIndex	getLocalTextureIndex() const;
 
 	const std::string&		getName() const;
 	const LLTexLayerSet* const getTexLayerSet() const 	{ return mTexLayerSet; }
@@ -211,7 +213,7 @@ class LLTexLayerSet
 	LLAvatarAppearance*			getAvatarAppearance()	const		{ return mAvatarAppearance; }
 	const std::string			getBodyRegionName() const;
 	BOOL						hasComposite() const 		{ return (mComposite.notNull()); }
-	LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
+	LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() const { return mBakedTexIndex; }
 	void						setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
 	BOOL						isVisible() const 			{ return mIsVisible; }
 
-- 
GitLab