diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-12-08 13:12:28 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-12-08 13:12:28 -0500 |
commit | c9981ec59c4613531b2d5bb03f6ab8f6d914343c (patch) | |
tree | 59d1ea54466a26d54db61fb67f2d345187cf99e1 /indra/newview | |
parent | 7c2915518978884823e74f8d4d29a1a3073eb39c (diff) |
SL-92 WIP - hover height communicated via appearance messages.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/app_settings/logcontrol.xml | 2 | ||||
-rwxr-xr-x | indra/newview/llfloaterhoverheight.cpp | 46 | ||||
-rwxr-xr-x | indra/newview/llfloaterhoverheight.h | 2 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 30 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 1 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 2 |
6 files changed, 73 insertions, 10 deletions
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 29639bb9c2..de3732f339 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ </array> <key>tags</key> <array> - <string>Avatar</string> <!-- sample entry for debugging specific items + <string>Avatar</string> <string>Inventory</string> <string>SceneLoadTiming</string> <string>Avatar</string> diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index 6f7f8374d2..f25d491910 100755 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -30,6 +30,28 @@ #include "llfloaterhoverheight.h" #include "llsliderctrl.h" #include "llviewercontrol.h" +#include "llsdserialize.h" +#include "llhttpclient.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" + +class LLHoverHeightResponder: public LLHTTPClient::Responder +{ +public: + LLHoverHeightResponder(): LLHTTPClient::Responder() {} + +private: + void httpFailure() + { + LL_WARNS() << dumpResponse() << LL_ENDL; + } + + void httpSuccess() + { + LL_INFOS() << dumpResponse() << LL_ENDL; + } +}; LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key) { @@ -53,12 +75,6 @@ BOOL LLFloaterHoverHeight::postBuild() // static void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) { - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - F32 value = sldrCtrl->getValueF32(); - - LLVector3 offset = gSavedSettings.getVector3("AvatarPosFinalOffset"); - offset[2] = value; - gSavedSettings.setVector3("AvatarPosFinalOffset",offset); } // Do extra send-to-the-server work when slider drag completes, or new @@ -66,4 +82,22 @@ void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) void LLFloaterHoverHeight::onFinalCommit() { LL_INFOS() << "FINAL FINAL!!!" << LL_ENDL; + sendHoverHeightUpdate(); +} + +void LLFloaterHoverHeight::sendHoverHeightUpdate() +{ + LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider"); + F32 value = sldrCtrl->getValueF32(); + + std::string url = gAgent.getRegion()->getCapability("AgentPreferences"); + + if (!url.empty()) + { + LLSD update = LLSD::emptyMap(); + update["hover_height"] = value; + + LL_INFOS() << "updating hover height to " << value << LL_ENDL; + LLHTTPClient::post(url, update, new LLHoverHeightResponder); + } } diff --git a/indra/newview/llfloaterhoverheight.h b/indra/newview/llfloaterhoverheight.h index 1aede19e57..b81f293ae5 100755 --- a/indra/newview/llfloaterhoverheight.h +++ b/indra/newview/llfloaterhoverheight.h @@ -38,6 +38,8 @@ public: static void onSliderMoved(LLUICtrl* ctrl, void* userData); void onFinalCommit(); + + void sendHoverHeightUpdate(); }; #endif diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 2c1dedede0..d150ace455 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -252,6 +252,8 @@ struct LLAppearanceMessageContents //U32 appearance_flags = 0; std::vector<F32> mParamWeights; std::vector<LLVisualParam*> mParams; + LLVector3 mHoverOffset; + bool mHoverOffsetWasSet; }; struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock<LLVOAvatarChildJoint> @@ -717,7 +719,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), mLastUpdateRequestCOFVersion(-1), - mLastUpdateReceivedCOFVersion(-1) + mLastUpdateReceivedCOFVersion(-1), + mHoverOffset(0.0, 0.0, 0.0) { //VTResume(); // VTune @@ -1959,6 +1962,11 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, // Do base class updates... U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); + //LLTEContents tec; + //S32 te_retval = parseTEMessage(mesgsys, _PREHASH_ObjectData, block_num, tec); + + LL_DEBUGS("Avatar") << avString() << update_type << LL_ENDL; + // Print out arrival information once we have name of avatar. if (has_name && getNVPair("FirstName")) { @@ -3411,7 +3419,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(gSavedSettings.getVector3("AvatarPosFinalOffset")); + root_pos += LLVector3d(mHoverOffset); LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); @@ -3581,7 +3589,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) else if (mDrawable.notNull()) { LLVector3 pos = mDrawable->getPosition(); - pos += gSavedSettings.getVector3("AvatarPosFinalOffset"); + pos += mHoverOffset; mRoot->setPosition(pos); mRoot->setRotation(mDrawable->getRotation()); } @@ -7007,6 +7015,17 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe // For future use: //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } + + // Parse the AppearanceData field, if any. + contents.mHoverOffsetWasSet = false; + if (mesgsys->has(_PREHASH_AppearanceHover)) + { + LLVector3 hover; + mesgsys->getVector3Fast(_PREHASH_AppearanceHover, _PREHASH_HoverHeight, hover); + LL_DEBUGS("Avatar") << avString() << " hover received " << hover.mV[ VX ] << "," << hover.mV[ VY ] << "," << hover.mV[ VZ ] << LL_ENDL; + contents.mHoverOffset = hover; + contents.mHoverOffsetWasSet = true; + } // Parse visual params, if any. S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); @@ -7308,6 +7327,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } + if (contents.mHoverOffsetWasSet) + { + mHoverOffset = contents.mHoverOffset; + } + setCompositeUpdatesEnabled( TRUE ); // If all of the avatars are completely baked, release the global image caches to conserve memory. diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 42ff7bff92..445f0ff921 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -210,6 +210,7 @@ public: /*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position); virtual void updateVisualParams(); + LLVector3 mHoverOffset; /** Inherited ** ** diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 42a7c2e576..f4c6472f7a 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -163,6 +163,8 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, { mMotionController.mIsSelf = TRUE; + mHoverOffset = gSavedSettings.getVector3("AvatarPosFinalOffset"); + LL_DEBUGS() << "Marking avatar as self " << id << LL_ENDL; } |