From 62ab044b1ac9f757be40f951436ff11419feffb4 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 5 Jan 2015 15:34:40 -0500
Subject: [PATCH] SL-92 WIP - changed setting name to AvatarHoverOffsetZ

---
 .../newview/app_settings/settings_per_account.xml  |  4 ++--
 indra/newview/llfloaterhoverheight.cpp             | 14 +++++++-------
 indra/newview/llvoavatar.cpp                       |  4 ++--
 indra/newview/llvoavatarself.cpp                   |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 97d81153a7a..d119504017d 100755
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -1,9 +1,9 @@
 <llsd>
     <map>
-    <key>AvatarPosFinalOffset</key>
+    <key>AvatarHoverOffsetZ</key>
     <map>
       <key>Comment</key>
-      <string>After-everything-else fixup for avatar position.</string>
+      <string>After-everything-else fixup for avatar Z position.</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp
index dc8a3d6fb85..2ac61efc0c1 100755
--- a/indra/newview/llfloaterhoverheight.cpp
+++ b/indra/newview/llfloaterhoverheight.cpp
@@ -42,16 +42,16 @@ LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key)
 
 void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data)
 {
-	F32 value = gSavedPerAccountSettings.getF32("AvatarPosFinalOffset");
+	F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
 
 	LLFloaterHoverHeight *self = static_cast<LLFloaterHoverHeight*>(user_data);
 	LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("HoverHeightSlider");
 	sldrCtrl->setValue(value,FALSE);
 
-	//value = sldrCtrl->getValueF32();
-	//gAgentAvatarp->mHoverOffset = LLVector3(0.0, 0.0, value);
 	if (isAgentAvatarValid())
 	{
+		LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z));
+		gAgentAvatarp->mHoverOffset = offset;
 		gAgentAvatarp->sendHoverHeight();
 	}
 }
@@ -68,13 +68,13 @@ BOOL LLFloaterHoverHeight::postBuild()
 	// Initialize slider from pref setting.
 	syncFromPreferenceSetting(this);
 	// Update slider on future pref changes.
-	if (gSavedPerAccountSettings.getControl("AvatarPosFinalOffset"))
+	if (gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ"))
 	{
-		gSavedPerAccountSettings.getControl("AvatarPosFinalOffset")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this));
+		gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this));
 	}
 	else
 	{
-		LL_WARNS() << "Control not found for AvatarPosFinalOffset" << LL_ENDL;
+		LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL;
 	}
 
 	return TRUE;
@@ -95,7 +95,7 @@ void LLFloaterHoverHeight::onFinalCommit()
 {
 	LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
 	F32 value = sldrCtrl->getValueF32();
-	gSavedPerAccountSettings.setF32("AvatarPosFinalOffset",value);
+	gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value);
 }
 
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index fd741e7e5f8..6669a797ce1 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7470,12 +7470,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 		mHoverOffset = contents.mHoverOffset;
 	}
 
-	if (!contents.mHoverOffsetWasSet)
+	if (!contents.mHoverOffsetWasSet && !isSelf())
 	{
 		// If we don't get a value at all, we are presumably in a
 		// region that does not support hover height.
 
-		LL_WARNS() << "zeroing hover because not defined in appearance message" << LL_ENDL;
+		LL_WARNS() << avString() << "zeroing hover because not defined in appearance message" << LL_ENDL;
 		mHoverOffset = LLVector3(0.0, 0.0, 0.0);
 	}
 
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 1b5901e5819..ed560b1c30b 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -239,7 +239,7 @@ void LLVOAvatarSelf::initInstance()
 		return;
 	}
 
-	F32 hover_z = gSavedPerAccountSettings.getF32("AvatarPosFinalOffset");
+	F32 hover_z = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ");
 	mHoverOffset = LLVector3(0.0, 0.0, llclamp(hover_z,MIN_HOVER_Z,MAX_HOVER_Z));
 	LL_INFOS("Avatar") << avString() << " set hover height from debug setting " << mHoverOffset[2] << LL_ENDL;
 
-- 
GitLab