From 2cd1460763090bcf6e7f408caf11c0ecd596520f Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Wed, 21 Feb 2018 15:10:40 +0200
Subject: [PATCH] MAINT-2564 FIXED Alpha mask does not hide hair in the Outfit
 Editor

---
 indra/newview/llpaneleditwearable.cpp | 2 +-
 indra/newview/llvoavatar.cpp          | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index a46fb3dfeb9..3a8378f8dfd 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -1624,7 +1624,7 @@ void LLPanelEditWearable::initPreviousAlphaTextures()
         initPreviousAlphaTextureEntry(TEX_UPPER_ALPHA);
         initPreviousAlphaTextureEntry(TEX_HEAD_ALPHA);
         initPreviousAlphaTextureEntry(TEX_EYES_ALPHA);
-        initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
+        initPreviousAlphaTextureEntry(TEX_HAIR_ALPHA);
 }
 
 void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te)
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 652a4475454..966fe45e346 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7366,11 +7366,13 @@ void LLVOAvatar::updateMeshTextures()
 			debugColorizeSubMeshes(i,LLColor4::blue);
 		}
 	}
+	static LLUUID default_alpha_uuid = LLUUID(gSavedSettings.getString("UIImgDefaultAlphaUUID"));
+	bool hair_alpha_exists = (getImage(TEX_HAIR_ALPHA, 0) && getImage(TEX_HAIR_ALPHA, 0)->getID() != default_alpha_uuid);
 
 	// set texture and color of hair manually if we are not using a baked image.
 	// This can happen while loading hair for yourself, or for clients that did not
 	// bake a hair texture. Still needed for yourself after 1.22 is depricated.
-	if (!is_layer_baked[BAKED_HAIR] || isEditingAppearance())
+	if (!is_layer_baked[BAKED_HAIR] || (isEditingAppearance() && !hair_alpha_exists))
 	{
 		const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1);
 		LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 );
-- 
GitLab