From 93e210d91f521b01deb10aa6aa25160364e6ae28 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 26 Sep 2012 15:45:58 -0400
Subject: [PATCH] more state management stuff, DRANO flags for problematic
 areas

---
 indra/llappearance/lldriverparam.cpp    |  3 ++-
 indra/llappearance/lltexlayerparams.cpp |  8 ++------
 indra/newview/llagent.cpp               | 12 ++++++++----
 indra/newview/llviewertexlayer.cpp      |  3 +--
 indra/newview/llviewerwearable.cpp      |  2 ++
 indra/newview/llviewerwindow.cpp        |  3 +--
 indra/newview/llvoavatar.cpp            |  2 +-
 indra/newview/llvoavatarself.cpp        | 16 ++++------------
 8 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp
index a43878899c9..2d91ebdee9c 100755
--- a/indra/llappearance/lldriverparam.cpp
+++ b/indra/llappearance/lldriverparam.cpp
@@ -187,7 +187,8 @@ BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
 {
 	llassert(wearable);
 	LLDriverParam *new_param = new LLDriverParam(mAvatarAppearance, wearable);
-	// FIXME DRANO this clobbers mWearablep, which means any code currently using mWearablep is wrong.
+	// FIXME DRANO this clobbers mWearablep, which means any code
+	// currently using mWearablep is wrong, or at least untested.
 	*new_param = *this;
 //	new_param->mDriven.clear(); // clear driven list to avoid overwriting avatar driven params from wearables. 
 	return new_param;
diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp
index 18e70af23c6..32bdba4e1c9 100755
--- a/indra/llappearance/lltexlayerparams.cpp
+++ b/indra/llappearance/lltexlayerparams.cpp
@@ -174,13 +174,9 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
 	{
 		mCurWeight = new_weight;
 
-		if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
+		if ((mAvatarAppearance->getSex() & getSex()) &&
+			(mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
 		{
-			// FIXME DRANO - is this check right?
-			if (!mAvatarAppearance->isUsingServerBakes())
-			{
-				upload_bake = FALSE;
-			}
 			mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
 			mTexLayer->invalidateMorphMasks();
 		}
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index ffcd263d061..bb9f8eaa26f 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3630,8 +3630,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 		return;
 	}
 
-	// FIXME DRANO wrong check
-	if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes())
+	if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
 	{
 		// ignore baked textures when in customize mode
 		return;
@@ -4261,11 +4260,16 @@ void LLAgent::requestLeaveGodMode()
 //-----------------------------------------------------------------------------
 void LLAgent::sendAgentSetAppearance()
 {
+	// FIXME DRANO - this return short-circuits a bunch of phase stat tracking below.
 	if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return;
 
+	// FIXME DRANO - problems around new-style appearance in an old-style region.
+	// - does this get called?
+	// - need to change mUseServerBakes->FALSE in that case
+	// - need to call processAvatarAppearance as if server had returned this result?
+	// gAgentAvatarp->mUseServerBakes = FALSE;
 
-	// FIXME DRANO - remove server bake check, covered by central bake check above?
-	if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes())) 
+	if (gAgentQueryManager.mNumPendingQueries > 0) 
 	{
 		return;
 	}
diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp
index 9477e89f1c5..b129c28e0d9 100755
--- a/indra/newview/llviewertexlayer.cpp
+++ b/indra/newview/llviewertexlayer.cpp
@@ -285,8 +285,7 @@ BOOL LLViewerTexLayerSetBuffer::uploadInProgress() const
 BOOL LLViewerTexLayerSetBuffer::isReadyToUpload() const
 {
 	if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries.
-	// FIXME DRANO - should be checking local appearance?
-	if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) return FALSE; // Don't upload if avatar is using composites.
+	if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance()) return FALSE; // Don't upload if avatar is being edited.
 
 	BOOL ready = FALSE;
 	if (getViewerTexLayerSet()->isLocalTextureDataFinal())
diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp
index 373cc63b414..bd277349d62 100755
--- a/indra/newview/llviewerwearable.cpp
+++ b/indra/newview/llviewerwearable.cpp
@@ -537,6 +537,8 @@ void LLViewerWearable::setVisualParams()
 
 void LLViewerWearable::revertValues()
 {
+	// FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
+
 	//update saved settings so wearable is no longer dirty
 	// non-driver params first
 	for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index d6d127ddfca..209e49940a2 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -4731,8 +4731,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
 		gResizeScreenTexture = TRUE;
 		gWindowResized = TRUE;
 
-		// FIXME DRANO - what to check against here?
-		if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes())
+		if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
 		{
 			LLVisualParamHint::requestHintUpdates();
 		}
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 0f18aa358c6..a7a08208d42 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -626,7 +626,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mLastRezzedStatus(-1),
 	mIsEditingAppearance(FALSE),
 	mUseLocalAppearance(FALSE),
-	mUseServerBakes(TRUE)
+	mUseServerBakes(FALSE)
 {
 	LLMemType mt(LLMemType::MTYPE_AVATAR);
 	//VTResume();  // VTune
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 6f58ffc5c18..65cadb66df6 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1274,12 +1274,8 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr
 			discard_level < local_tex_obj->getDiscard())
 		{
 			local_tex_obj->setDiscard(discard_level);
-			// FIXME DRANO - should this be a local appearance check?
-			if (isUsingServerBakes())
-			{
-				requestLayerSetUpdate(index);
-			}
-			else
+			requestLayerSetUpdate(index);
+			if (isEditingAppearance())
 			{
 				LLVisualParamHint::requestHintUpdates();
 			}
@@ -1759,12 +1755,8 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
 					local_tex_obj->setDiscard(tex_discard);
 					if (isSelf())
 					{
-						// FIXME DRANO
-						if (gAgentAvatarp->isUsingServerBakes())
-						{
-							requestLayerSetUpdate(type);
-						}
-						else
+						requestLayerSetUpdate(type);
+						if (isEditingAppearance())
 						{
 							LLVisualParamHint::requestHintUpdates();
 						}
-- 
GitLab