diff options
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b54f341c31..da0e72a6ee 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> @@ -716,7 +718,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 @@ -772,6 +775,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRuthTimer.reset(); mRuthDebugTimer.reset(); mDebugExistenceTimer.reset(); + mLastAppearanceMessageTimer.reset(); if(LLSceneMonitor::getInstance()->isEnabled()) { @@ -1955,6 +1959,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")) { @@ -3208,6 +3217,17 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) debug_line += llformat(" - cof rcv:%d", last_received_cof_version); } debug_line += llformat(" bsz-z: %f avofs-z: %f", mBodySize[2], mAvatarOffset[2]); + if (mHoverOffset[2] != 0.0) + { + debug_line += llformat(" hov_z: %f", mHoverOffset[2]); + } + F32 elapsed = mLastAppearanceMessageTimer.getElapsedTimeF32(); + static const char *elapsed_chars = "Xx*..."; + U32 bucket = U32(elapsed*2); + if (bucket < strlen(elapsed_chars)) + { + debug_line += llformat(" %c", elapsed_chars[bucket]); + } addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) @@ -3408,9 +3428,11 @@ 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); LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); + if (newPosition != mRoot->getXform()->getWorldPosition()) { mRoot->touch(); @@ -3575,7 +3597,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } else if (mDrawable.notNull()) { - mRoot->setPosition(mDrawable->getPosition()); + LLVector3 pos = mDrawable->getPosition(); + pos += mHoverOffset * mDrawable->getRotation(); + mRoot->setPosition(pos); mRoot->setRotation(mDrawable->getRotation()); } @@ -7117,6 +7141,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); @@ -7234,6 +7269,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + mLastAppearanceMessageTimer.reset(); + ESex old_sex = getSex(); LLAppearanceMessageContents contents; @@ -7418,6 +7455,27 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } + if (isSelf()) + { + LL_INFOS("Avatar") << "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.) + mHoverOffset = contents.mHoverOffset; + } + + if (!contents.mHoverOffsetWasSet) + { + // If we don't get a value at all, we are presumably in a + // region that does not support hover height. +// FIXME RESTORE AFTER TESTING + LL_WARNS() << "zeroing hover because not defined in appearance message" << LL_ENDL; + mHoverOffset = LLVector3(0.0, 0.0, 0.0); + } + setCompositeUpdatesEnabled( TRUE ); // If all of the avatars are completely baked, release the global image caches to conserve memory. |