diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-01-15 16:45:24 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-01-15 16:45:24 -0500 |
commit | d2de97ad8e84eedd42f4a0fe5b258617a96f154b (patch) | |
tree | 21a60e9d713c5f0cc49bb157772af233ebe8faa9 /indra/newview | |
parent | be83e48fc12fbaf225f9f3e6ad5042320595ce26 (diff) |
SL-92 WIP - more on hover management
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterhoverheight.cpp | 24 | ||||
-rwxr-xr-x | indra/newview/llfloaterhoverheight.h | 4 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 32 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.h | 4 |
5 files changed, 61 insertions, 21 deletions
diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index 7d0c011b74..8908626de6 100755 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -51,9 +51,9 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data) if (isAgentAvatarValid()) { 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(); + LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL; + gAgentAvatarp->setHoverOffset(offset); + //gAgentAvatarp->sendHoverHeight(); } } @@ -84,18 +84,28 @@ BOOL LLFloaterHoverHeight::postBuild() { mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this)); } + // Set up based on initial region. + onRegionChanged(); return TRUE; } +void LLFloaterHoverHeight::onClose(bool app_quitting) +{ + if (mRegionChangedSlot.connected()) + { + mRegionChangedSlot.disconnect(); + } +} + // static 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; + LL_INFOS("Avatar") << "setting hover from slider moved" << offset[2] << LL_ENDL; + gAgentAvatarp->setHoverOffset(offset, false); } // Do send-to-the-server work when slider drag completes, or new @@ -105,6 +115,10 @@ void LLFloaterHoverHeight::onFinalCommit() LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider"); F32 value = sldrCtrl->getValueF32(); gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value); + + 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. } void LLFloaterHoverHeight::onRegionChanged() diff --git a/indra/newview/llfloaterhoverheight.h b/indra/newview/llfloaterhoverheight.h index 8809fc1bf8..ee065bc184 100755 --- a/indra/newview/llfloaterhoverheight.h +++ b/indra/newview/llfloaterhoverheight.h @@ -45,8 +45,8 @@ public: void onSimulatorFeaturesReceived(const LLUUID ®ion_id); void updateEditEnabled(); - - boost::signals2::connection mRegionChangedSlot; + /*virtual*/ void onClose(bool app_quitting); + boost::signals2::connection mRegionChangedSlot; }; #endif diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b5bf174045..38420a31bc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -724,7 +724,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastUpdateReceivedCOFVersion(-1) { //VTResume(); // VTune - mHoverOffset = LLVector3(0.0, 0.0, 0.0); + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); + // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline const BOOL needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); @@ -3221,9 +3222,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) debug_line += llformat(" bsz-z: %f avofs-z: %f", mBodySize[2], mAvatarOffset[2]); bool hover_enabled = getRegion() && getRegion()->avatarHoverHeightEnabled(); debug_line += hover_enabled ? " H" : " h"; - if (mHoverOffset[2] != 0.0) + const LLVector3& hover_offset = getHoverOffset(); + if (hover_offset[2] != 0.0) { - debug_line += llformat(" hov_z: %f", mHoverOffset[2]); + debug_line += llformat(" hov_z: %f", hover_offset[2]); } F32 elapsed = mLastAppearanceMessageTimer.getElapsedTimeF32(); static const char *elapsed_chars = "Xx*..."; @@ -3432,7 +3434,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // correct for the fact that the pelvis is not necessarily the center // of the agent's physical representation root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; - root_pos += LLVector3d(mHoverOffset); + root_pos += LLVector3d(getHoverOffset()); LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); @@ -3602,7 +3604,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) else if (mDrawable.notNull()) { LLVector3 pos = mDrawable->getPosition(); - pos += mHoverOffset * mDrawable->getRotation(); + pos += getHoverOffset() * mDrawable->getRotation(); mRoot->setPosition(pos); mRoot->setRotation(mDrawable->getRotation()); } @@ -7463,8 +7465,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { // 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; + setHoverOffset(contents.mHoverOffset); + LL_INFOS("Avatar") << avString() << "setting hover from message" << contents.mHoverOffset[2] << LL_ENDL; } if (!contents.mHoverOffsetWasSet && !isSelf()) @@ -7472,7 +7474,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // If we don't get a value at all, we are presumably in a // region that does not support hover height. LL_WARNS() << avString() << "zeroing hover because not defined in appearance message" << LL_ENDL; - mHoverOffset = LLVector3(0.0, 0.0, 0.0); + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); } setCompositeUpdatesEnabled( TRUE ); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 5341c6f1c8..bd7ab41258 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -178,7 +178,10 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, mScreenp(NULL), mLastRegionHandle(0), mRegionCrossingCount(0), - mInitialBakesLoaded(false) + 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; @@ -253,12 +256,12 @@ void LLVOAvatarSelf::setHoverIfRegionEnabled() 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; + 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 { - mHoverOffset = LLVector3(0.0, 0.0, 0.0); + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); LL_INFOS("Avatar") << avString() << " zeroing hover height, region does not support" << LL_ENDL; } } @@ -2776,10 +2779,27 @@ void LLVOAvatarSelf::sendHoverHeight() const if (!url.empty()) { LLSD update = LLSD::emptyMap(); - update["hover_height"] = mHoverOffset[2]; + const LLVector3& hover_offset = getHoverOffset(); + update["hover_height"] = hover_offset[2]; - LL_DEBUGS("Avatar") << avString() << "sending hover height value " << mHoverOffset[2] << LL_ENDL; + 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(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 6e585520da..6d190b5cfe 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -333,6 +333,10 @@ public: // -- care and feeding of hover height. void setHoverIfRegionEnabled(); void sendHoverHeight() const; + /*virtual*/ void setHoverOffset(const LLVector3& hover_offset, bool send_update=true); + +private: + mutable LLVector3 mLastHoverOffsetSent; /** Appearance ** ** |