From 12c2cf453fe324980aef10278cb8f111452ab02c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 9 Apr 2015 00:36:12 +0200 Subject: [PATCH] Wire this up for OpenSim et al --- indra/newview/llfloaterhoverheight.cpp | 46 ++++++++++++++++++++++++-- indra/newview/llviewercontrol.cpp | 10 +++--- indra/newview/llviewermenu.cpp | 5 ++- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 5 +-- indra/newview/rlvcommon.h | 1 + indra/newview/rlvhandler.cpp | 7 +++- 7 files changed, 61 insertions(+), 15 deletions(-) diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index 8908626de6..374a2ba6c7 100755 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -36,6 +36,10 @@ #include "llviewerregion.h" #include "llvoavatarself.h" +#ifdef OPENSIM +#include "llviewernetwork.h" +#endif + LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key) { } @@ -52,7 +56,18 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data) { LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL; + // Legacy baking avatar z-offset + //gAgentAvatarp->setHoverOffset(offset); +#ifdef OPENSIM + // Hackish, but we don't want to set it when using legacy baking at all + if (LLGridManager::getInstance()->isInSecondLife() || gAgentAvatarp->isUsingServerBakes()) + { + gAgentAvatarp->setHoverOffset(offset); + } +#else gAgentAvatarp->setHoverOffset(offset); +#endif + // //gAgentAvatarp->sendHoverHeight(); } } @@ -105,7 +120,17 @@ void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) F32 value = sldrCtrl->getValueF32(); LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); LL_INFOS("Avatar") << "setting hover from slider moved" << offset[2] << LL_ENDL; - gAgentAvatarp->setHoverOffset(offset, false); + // Legacy baking avatar z-offset + //gAgentAvatarp->setHoverOffset(offset, false); + if (gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled()) + { + gAgentAvatarp->setHoverOffset(offset, false); + } + else if (!gAgentAvatarp->isUsingServerBakes()) + { + gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ", value); + } + // } // Do send-to-the-server work when slider drag completes, or new @@ -114,11 +139,20 @@ void LLFloaterHoverHeight::onFinalCommit() { LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); F32 value = sldrCtrl->getValueF32(); + // Legacy baking avatar z-offset + LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value); - LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); + // Legacy baking avatar z-offset + //LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); LL_INFOS("Avatar") << "setting hover from slider final commit " << offset[2] << LL_ENDL; - gAgentAvatarp->setHoverOffset(offset, true); // will send update this time. + // Legacy baking avatar z-offset + //gAgentAvatarp->setHoverOffset(offset, true); // will send update this time. + if (gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled()) + { + gAgentAvatarp->setHoverOffset(offset, true); + } + // } void LLFloaterHoverHeight::onRegionChanged() @@ -146,6 +180,12 @@ void LLFloaterHoverHeight::onSimulatorFeaturesReceived(const LLUUID ®ion_id) void LLFloaterHoverHeight::updateEditEnabled() { bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); + // Legacy baking avatar z-offset + if (!enabled && !gAgentAvatarp->isUsingServerBakes()) + { + enabled = true; + } + // LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); sldrCtrl->setEnabled(enabled); if (enabled) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index b255bd4712..63e9d524b4 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -92,6 +92,7 @@ #include "llpanelplaces.h" #include "llstatusbar.h" #include "NACLantispam.h" +#include "llviewerregion.h" // Third party library includes #include @@ -577,16 +578,16 @@ bool handleVelocityInterpolate(const LLSD& newvalue) return true; } -// ## Zi: Moved Avatar Z offset from RLVa to here +// Moved Avatar Z offset from RLVa to here bool handleAvatarZOffsetChanged(const LLSD& sdValue) { - if (isAgentAvatarValid()) + if (gAgent.getRegion() && !gAgent.getRegion()->avatarHoverHeightEnabled() && isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()) { gAgentAvatarp->computeBodySize(); } return true; } -// ## Zi: Moved Avatar Z offset from RLVa to here +// Moved Avatar Z offset from RLVa to here bool handleForceShowGrid(const LLSD& newvalue) { @@ -965,8 +966,7 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); - // FIRE-9759 - Temporarily remove AvatarZOffset since it's broken - //gSavedPerAccountSettings.getControl("AvatarZOffset")->getSignal()->connect(boost::bind(&handleAvatarZOffsetChanged, _2)); // ## Zi: Moved Avatar Z offset from RLVa to here + gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getSignal()->connect(boost::bind(&handleAvatarZOffsetChanged, _2)); // Moved Avatar Z offset from RLVa to here // Is done inside XUI now, using visibility_control // gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2)); // diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 686da84e6c..9a8ae7f669 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4828,7 +4828,10 @@ class LLEnableHoverHeight : public view_listener_t { bool handleEvent(const LLSD& userdata) { - return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); + // Legacy baking avatar z-offset + //return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); + return (gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled()) || (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes()); + // } }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a5e3d4f4ec..fc22b45a91 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3361,7 +3361,7 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) name_position = mRoot->getWorldPosition(); name_position[VZ] -= mPelvisToFoot; - name_position[VZ] += ((mBodySize[VZ] + mAvatarOffset[VZ])* 0.55f); + name_position[VZ] += ((mBodySize[VZ] - mAvatarOffset[VZ] * 0.9f) * 0.55f); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); name_position += pixel_up_vec * 15.f; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 020a508950..8c3f9e497f 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -3308,10 +3308,7 @@ void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile) // [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8) F32 LLVOAvatarSelf::getAvatarOffset() /*const*/ { - // FIRE-9759 - Temporarily remove setting AvatarZOffset - //return (isUsingServerBakes()) ? LLAvatarAppearance::getAvatarOffset() : RlvSettings::getAvatarOffsetZ(); - return LLAvatarAppearance::getAvatarOffset(); - // + return (isUsingServerBakes()) ? LLAvatarAppearance::getAvatarOffset() : RlvSettings::getAvatarOffsetZ(); } // [/RLVa:KB] diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index 2ab95393fc..b2b6ced019 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -78,6 +78,7 @@ template inline T rlvGetPerUserSetting(const std::string& strSetting class RlvSettings { public: + static F32 getAvatarOffsetZ() { return rlvGetPerUserSetting("AvatarHoverOffsetZ", 0.0f); } static bool getDebug() { return rlvGetSetting(RLV_SETTING_DEBUG, false); } static bool getCanOOC() { return fCanOOC; } static bool getForbidGiveToRLV() { return rlvGetSetting(RLV_SETTING_FORBIDGIVETORLV, true); } diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 350f7576b3..b185151cd3 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1639,10 +1639,15 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const nValue += rlvCmdOption.m_nPelvisToFootOffset; if (gAgentAvatarp->getRegion()->avatarHoverHeightEnabled()) { - LLVector3 avOffset(0.0, 0.0, llclamp(nValue, MIN_HOVER_Z, MAX_HOVER_Z)); + LLVector3 avOffset(0.0f, 0.0f, llclamp(nValue, MIN_HOVER_Z, MAX_HOVER_Z)); gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ", avOffset.mV[VZ]); gAgentAvatarp->setHoverOffset(avOffset, true); } + else if (!gAgentAvatarp->isUsingServerBakes()) + { + LLVector3 avOffset(0.0f, 0.0f, llclamp(nValue, MIN_HOVER_Z, MAX_HOVER_Z)); + gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ", avOffset.mV[VZ]); + } else { eRet = RLV_RET_FAILED_DISABLED;