From 05ee87af14c4d20e754aa525e4a3f78eb736a96b Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 26 Sep 2012 17:02:46 -0400
Subject: [PATCH] Fixed problems caused by defaulting mUseServerBakes to false

---
 indra/newview/llvoavatar.cpp     | 25 ++++++++++++-------------
 indra/newview/llvoavatarself.cpp |  5 ++++-
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a7a08208d42..f5299f0fa3e 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -6364,23 +6364,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 			<< " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL;
 
 
-	if( isSelf() )
-	{
-		llwarns << avString() << "Received AvatarAppearance for self" << llendl;
-		if( mFirstTEMessageReceived && !isUsingServerBakes())
-		{
-//			llinfos << "processAvatarAppearance end  " << mID << llendl;
-			return;
-		}
-	}
-
 	ESex old_sex = getSex();
 
-//	llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl;
-//	dumpAvatarTEs( "PRE  processAvatarAppearance()" );
 	LLTEContents tec;
 	parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec);
-//	dumpAvatarTEs( "POST processAvatarAppearance()" );
 
 	U8 appearance_version = 0;
 	S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN;
@@ -6405,6 +6392,18 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 		mUseServerBakes = false;
 	}
 
+	// Only now that we have result of appearance_version can we decide whether to bail out.
+	// Don't expect this case to occur.
+	if( isSelf() )
+	{
+		llwarns << avString() << "Received AvatarAppearance for self" << llendl;
+		if( mFirstTEMessageReceived && !isUsingServerBakes())
+		{
+			return;
+		}
+	}
+
+
 	// Check for stale update.
 	if (isUsingServerBakes() && isSelf()
 		&& this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 65cadb66df6..7ca40a8752f 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -746,7 +746,10 @@ U32  LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys,
 {
 	U32 retval = LLVOAvatar::processUpdateMessage(mesgsys,user_data,block_num,update_type,dp);
 
-	if (mInitialBakesLoaded == false && retval == 0x0)
+	// FIXME DRANO - skipping in the case of !mFirstAppearanceMessageReceived prevents us from trying to
+	// load textures before we know where they come from (ie, from baking service or not);
+	// unknown impact on performance.
+	if (mInitialBakesLoaded == false && retval == 0x0 && mFirstAppearanceMessageReceived)
 	{
 		// call update textures to force the images to be created
 		updateMeshTextures();
-- 
GitLab