diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterhoverheight.cpp | 6 | ||||
-rwxr-xr-x | indra/newview/llfloaterhoverheight.h | 2 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 48 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.h | 5 |
5 files changed, 59 insertions, 15 deletions
diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index 69b58b3af5..7d0c011b74 100755 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -52,6 +52,7 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data) { LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); gAgentAvatarp->mHoverOffset = offset; + LL_INFOS("Avatar") << "set hover from preference setting" << offset[2] << LL_ENDL; gAgentAvatarp->sendHoverHeight(); } } @@ -79,9 +80,9 @@ BOOL LLFloaterHoverHeight::postBuild() updateEditEnabled(); - if (!mRegionBoundarySlot.connected()) + if (!mRegionChangedSlot.connected()) { - mRegionBoundarySlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this)); + mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this)); } return TRUE; @@ -93,6 +94,7 @@ void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); F32 value = sldrCtrl->getValueF32(); LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); + LL_INFOS("Avatar") << "set hover from slider moved" << offset[2] << LL_ENDL; gAgentAvatarp->mHoverOffset = offset; } diff --git a/indra/newview/llfloaterhoverheight.h b/indra/newview/llfloaterhoverheight.h index 8fd24d8813..8809fc1bf8 100755 --- a/indra/newview/llfloaterhoverheight.h +++ b/indra/newview/llfloaterhoverheight.h @@ -46,7 +46,7 @@ public: void updateEditEnabled(); - boost::signals2::connection mRegionBoundarySlot; + boost::signals2::connection mRegionChangedSlot; }; #endif diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 10bc6ad336..b5bf174045 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -722,7 +722,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mUseLocalAppearance(FALSE), mLastUpdateRequestCOFVersion(-1), mLastUpdateReceivedCOFVersion(-1) - //mHoverOffset(0.0, 0.0, 0.0) { //VTResume(); // VTune mHoverOffset = LLVector3(0.0, 0.0, 0.0); @@ -7460,19 +7459,15 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - if (isSelf()) - { - LL_INFOS("Avatar") << avString() << "hover was set: " << contents.mHoverOffsetWasSet << " value_z " << contents.mHoverOffset[2] << LL_ENDL; - } - if (contents.mHoverOffsetWasSet && !isSelf()) { - // Got an update for some other avatar. - // (Ignore updates for self because they may be out of date.) + // Got an update for some other avatar + // Ignore updates for self, because we have a more authoritative value in the preferences. mHoverOffset = contents.mHoverOffset; + LL_INFOS("Avatar") << avString() << "setting hover from message" << mHoverOffset[2] << LL_ENDL; } - 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. diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index ed560b1c30..5341c6f1c8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -239,15 +239,40 @@ void LLVOAvatarSelf::initInstance() return; } - 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; + 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"); + 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; + } + else + { + mHoverOffset = 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; @@ -850,6 +875,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) { @@ -868,6 +899,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)) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index a47b6c3463..6e585520da 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -75,6 +75,9 @@ protected: // LLViewerObject interface and related //-------------------------------------------------------------------- public: + boost::signals2::connection mRegionChangedSlot; + + void onSimulatorFeaturesReceived(const LLUUID& region_id); /*virtual*/ void updateRegion(LLViewerRegion *regionp); /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); @@ -327,6 +330,8 @@ public: public: bool sendAppearanceMessage(LLMessageSystem *mesgsys) const; + // -- care and feeding of hover height. + void setHoverIfRegionEnabled(); void sendHoverHeight() const; /** Appearance |