diff options
author | Oz Linden <oz@lindenlab.com> | 2015-03-23 14:34:31 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2015-03-23 14:34:31 -0400 |
commit | 8e21b24a079684304b02485d8f28e9be8f16e6a0 (patch) | |
tree | 3a68b52d0f0557d89ae3c6b04d63dd55032cba55 /indra/newview/llvoavatarself.cpp | |
parent | d3477b738881acbdf2bd1cc7bfaadaaae3890be6 (diff) | |
parent | c489f1f8647a77c8c7d5fb5b721433dd72cb49c8 (diff) |
merge changes for 3.7.26-release
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index aa440c06a6..ff718b2c70 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -127,6 +127,25 @@ struct LocalTextureData LLTextureEntry *mTexEntry; }; +// TODO - this class doesn't really do anything, could just use a base +// class responder if nothing else gets added. +class LLHoverHeightResponder: public LLHTTPClient::Responder +{ +public: + LLHoverHeightResponder(): LLHTTPClient::Responder() {} + +private: + void httpFailure() + { + LL_WARNS() << dumpResponse() << LL_ENDL; + } + + void httpSuccess() + { + LL_INFOS() << dumpResponse() << LL_ENDL; + } +}; + //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- @@ -159,6 +178,10 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, mScreenp(NULL), mLastRegionHandle(0), mRegionCrossingCount(0) + mInitialBakesLoaded(false), + // Value outside legal range, so will always be a mismatch the + // first time through. + mLastHoverOffsetSent(LLVector3(0.0f, 0.0f, -999.0f)) { mMotionController.mIsSelf = TRUE; @@ -219,11 +242,40 @@ void LLVOAvatarSelf::initInstance() return; } + setHoverIfRegionEnabled(); + //doPeriodically(output_self_av_texture_diagnostics, 30.0); doPeriodically(update_avatar_rez_metrics, 5.0); doPeriodically(boost::bind(&LLVOAvatarSelf::checkStuckAppearance, this), 30.0); } +void LLVOAvatarSelf::setHoverIfRegionEnabled() +{ + if (getRegion() && getRegion()->simulatorFeaturesReceived()) + { + if (getRegion()->avatarHoverHeightEnabled()) + { + F32 hover_z = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ"); + setHoverOffset(LLVector3(0.0, 0.0, llclamp(hover_z,MIN_HOVER_Z,MAX_HOVER_Z))); + LL_INFOS("Avatar") << avString() << " set hover height from debug setting " << hover_z << LL_ENDL; + } + else + { + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); + LL_INFOS("Avatar") << avString() << " zeroing hover height, region does not support" << LL_ENDL; + } + } + else + { + LL_INFOS("Avatar") << avString() << " region or simulator features not known, no change on hover" << LL_ENDL; + if (getRegion()) + { + getRegion()->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1)); + } + + } +} + bool LLVOAvatarSelf::checkStuckAppearance() { const F32 CONDITIONAL_UNSTICK_INTERVAL = 300.0; @@ -834,6 +886,12 @@ void LLVOAvatarSelf::removeMissingBakedTextures() } } +void LLVOAvatarSelf::onSimulatorFeaturesReceived(const LLUUID& region_id) +{ + LL_INFOS("Avatar") << "simulator features received, setting hover based on region props" << LL_ENDL; + setHoverIfRegionEnabled(); +} + //virtual void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) { @@ -852,6 +910,17 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) //LL_INFOS() << "pos_from_old_region is " << global_pos_from_old_region // << " while pos_from_new_region is " << pos_from_new_region // << LL_ENDL; + + // Update hover height, or schedule callback, based on whether + // it's supported in this region. + if (regionp->simulatorFeaturesReceived()) + { + setHoverIfRegionEnabled(); + } + else + { + regionp->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1)); + } } if (!regionp || (regionp->getHandle() != mLastRegionHandle)) @@ -2708,6 +2777,39 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const return success; } +//------------------------------------------------------------------------ +// sendHoverHeight() +//------------------------------------------------------------------------ +void LLVOAvatarSelf::sendHoverHeight() const +{ + std::string url = gAgent.getRegion()->getCapability("AgentPreferences"); + + if (!url.empty()) + { + LLSD update = LLSD::emptyMap(); + const LLVector3& hover_offset = getHoverOffset(); + update["hover_height"] = hover_offset[2]; + + LL_DEBUGS("Avatar") << avString() << "sending hover height value " << hover_offset[2] << LL_ENDL; + LLHTTPClient::post(url, update, new LLHoverHeightResponder); + + mLastHoverOffsetSent = hover_offset; + } +} + +void LLVOAvatarSelf::setHoverOffset(const LLVector3& hover_offset, bool send_update) +{ + if (getHoverOffset() != hover_offset) + { + LL_INFOS("Avatar") << avString() << " setting hover due to change " << hover_offset[2] << LL_ENDL; + LLVOAvatar::setHoverOffset(hover_offset, send_update); + } + if (send_update && (hover_offset != mLastHoverOffsetSent)) + { + LL_INFOS("Avatar") << avString() << " sending hover due to change " << hover_offset[2] << LL_ENDL; + sendHoverHeight(); + } +} //------------------------------------------------------------------------ // needsRenderBeam() |