summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2015-03-04 14:29:41 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2015-03-04 14:29:41 -0500
commit1c496b21b286f131652150eed4d13870127bd001 (patch)
treedc379be4bfa78f5efae14cfa60738c35df5b637a /indra/newview/llvoavatar.cpp
parent2ab9678455ce2e894273cae1efd2e10f4aaee42b (diff)
MAINT-4858 FIX
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-xindra/newview/llvoavatar.cpp73
1 files changed, 52 insertions, 21 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3f75131780..a90fade3c9 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -3178,12 +3178,8 @@ void LLVOAvatar::forceUpdateVisualMuteSettings()
}
-//------------------------------------------------------------------------
-// updateCharacter()
-// called on both your avatar and other avatars
-//------------------------------------------------------------------------
-BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
-{
+void LLVOAvatar::updateDebugText()
+{
// clear debug text
mDebugText.clear();
@@ -3226,6 +3222,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (hover_offset[2] != 0.0)
{
debug_line += llformat(" hov_z: %f", hover_offset[2]);
+ debug_line += llformat(" %s", (mIsSitting ? "S" : "T"));
+ debug_line += llformat("%s", (isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED) ? "G" : "-"));
}
F32 elapsed = mLastAppearanceMessageTimer.getElapsedTimeF32();
static const char *elapsed_chars = "Xx*...";
@@ -3241,7 +3239,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (!mBakedTextureDebugText.empty())
addDebugText(mBakedTextureDebugText);
}
-
+
if (LLVOAvatar::sShowAnimationDebug)
{
for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin();
@@ -3270,6 +3268,27 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
}
}
+ if (!mDebugText.size() && mText.notNull())
+ {
+ mText->markDead();
+ mText = NULL;
+ }
+ else if (mDebugText.size())
+ {
+ setDebugText(mDebugText);
+ }
+ mDebugText.clear();
+
+}
+
+//------------------------------------------------------------------------
+// updateCharacter()
+// called on both your avatar and other avatars
+//------------------------------------------------------------------------
+BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
+{
+ updateDebugText();
+
if (!mIsBuilt)
{
return FALSE;
@@ -3378,9 +3397,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
LLVector3 xyVel = getVelocity();
xyVel.mV[VZ] = 0.0f;
speed = xyVel.length();
-
+ // remembering the value here prevents a display glitch if the
+ // animation gets toggled during this update.
+ bool was_sit_ground_constrained = isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED);
+
if (!(mIsSitting && getParent()))
{
+ // This case includes all configurations except sitting on an
+ // object, so does include ground sit.
+
//--------------------------------------------------------------------
// get timing info
// handle initial condition case
@@ -3434,7 +3459,10 @@ 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(getHoverOffset());
+ if (!mIsSitting && !was_sit_ground_constrained)
+ {
+ root_pos += LLVector3d(getHoverOffset());
+ }
LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos);
@@ -3624,7 +3652,21 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
{
updateMotions(LLCharacter::NORMAL_UPDATE);
}
-
+
+ // Special handling for sitting on ground.
+ if (!getParent() && (mIsSitting || was_sit_ground_constrained))
+ {
+
+ F32 off_z = LLVector3d(getHoverOffset()).mdV[VZ];
+ if (off_z != 0.0)
+ {
+ LLVector3 pos = mRoot->getWorldPosition();
+ pos.mV[VZ] += off_z;
+ mRoot->touch();
+ mRoot->setWorldPosition(pos);
+ }
+ }
+
// update head position
updateHeadOffset();
@@ -3708,17 +3750,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
mRoot->updateWorldMatrixChildren();
- if (!mDebugText.size() && mText.notNull())
- {
- mText->markDead();
- mText = NULL;
- }
- else if (mDebugText.size())
- {
- setDebugText(mDebugText);
- }
- mDebugText.clear();
-
//mesh vertices need to be reskinned
mNeedsSkin = TRUE;
return TRUE;