Wire this up for OpenSim et al

meow-7.2.2
Ansariel 2015-04-09 00:36:12 +02:00
parent 179156e009
commit 12c2cf453f
7 changed files with 61 additions and 15 deletions

View File

@ -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;
// <FS:Ansariel> 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
// </FS:Ansariel>
//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);
// <FS:Ansariel> 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);
}
// </FS:Ansariel>
}
// Do send-to-the-server work when slider drag completes, or new
@ -114,11 +139,20 @@ void LLFloaterHoverHeight::onFinalCommit()
{
LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
F32 value = sldrCtrl->getValueF32();
// <FS:Ansariel> 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));
// <FS:Ansariel> 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.
// <FS:Ansariel> Legacy baking avatar z-offset
//gAgentAvatarp->setHoverOffset(offset, true); // will send update this time.
if (gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled())
{
gAgentAvatarp->setHoverOffset(offset, true);
}
// </FS:Ansariel>
}
void LLFloaterHoverHeight::onRegionChanged()
@ -146,6 +180,12 @@ void LLFloaterHoverHeight::onSimulatorFeaturesReceived(const LLUUID &region_id)
void LLFloaterHoverHeight::updateEditEnabled()
{
bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
// <FS:Ansariel> Legacy baking avatar z-offset
if (!enabled && !gAgentAvatarp->isUsingServerBakes())
{
enabled = true;
}
// </FS:Ansariel>
LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider");
sldrCtrl->setEnabled(enabled);
if (enabled)

View File

@ -92,6 +92,7 @@
#include "llpanelplaces.h"
#include "llstatusbar.h"
#include "NACLantispam.h"
#include "llviewerregion.h"
// Third party library includes
#include <boost/algorithm/string.hpp>
@ -577,16 +578,16 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
return true;
}
// ## Zi: Moved Avatar Z offset from RLVa to here
// <FS:Zi> 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
// </FS:Zi> 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));
// <FS:CR> 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)); // <FS:Zi> Moved Avatar Z offset from RLVa to here
// <FS:Zi> Is done inside XUI now, using visibility_control
// gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2));
// </FS:Zi>

View File

@ -4828,7 +4828,10 @@ class LLEnableHoverHeight : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
// <FS:Ansariel> Legacy baking avatar z-offset
//return gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled();
return (gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled()) || (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes());
// </FS:Ansariel>
}
};

View File

@ -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;
}

View File

@ -3308,10 +3308,7 @@ void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile)
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
F32 LLVOAvatarSelf::getAvatarOffset() /*const*/
{
// <FS:CR> FIRE-9759 - Temporarily remove setting AvatarZOffset
//return (isUsingServerBakes()) ? LLAvatarAppearance::getAvatarOffset() : RlvSettings::getAvatarOffsetZ();
return LLAvatarAppearance::getAvatarOffset();
// </FS:CR>
return (isUsingServerBakes()) ? LLAvatarAppearance::getAvatarOffset() : RlvSettings::getAvatarOffsetZ();
}
// [/RLVa:KB]

View File

@ -78,6 +78,7 @@ template<typename T> inline T rlvGetPerUserSetting(const std::string& strSetting
class RlvSettings
{
public:
static F32 getAvatarOffsetZ() { return rlvGetPerUserSetting<F32>("AvatarHoverOffsetZ", 0.0f); }
static bool getDebug() { return rlvGetSetting<bool>(RLV_SETTING_DEBUG, false); }
static bool getCanOOC() { return fCanOOC; }
static bool getForbidGiveToRLV() { return rlvGetSetting<bool>(RLV_SETTING_FORBIDGIVETORLV, true); }

View File

@ -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<F32>(nValue, MIN_HOVER_Z, MAX_HOVER_Z));
LLVector3 avOffset(0.0f, 0.0f, llclamp<F32>(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<F32>(nValue, MIN_HOVER_Z, MAX_HOVER_Z));
gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ", avOffset.mV[VZ]);
}
else
{
eRet = RLV_RET_FAILED_DISABLED;