summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-05-14 22:55:33 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-05-15 14:43:12 +0300
commit847cce915dd54166ca3b4fd6bfb8b3c697433abf (patch)
tree60988d3d974b7b0ed3c71bd8b89b78e97e19b675 /indra/newview/llvoavatar.cpp
parent0828d7375af44aa270635f374c993959ae3e2a28 (diff)
SL-12237 Remade updates for invisible avatars
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index f43391b477..7e8f65a046 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -3901,16 +3901,15 @@ void LLVOAvatar::updateFootstepSounds()
}
//------------------------------------------------------------------------
-// computeUpdatePeriodAndVisibility()
+// computeUpdatePeriod()
// Factored out from updateCharacter()
// Set new value for mUpdatePeriod based on distance and various other factors.
-// Returs true if character needs an update
//------------------------------------------------------------------------
-BOOL LLVOAvatar::computeUpdatePeriodAndVisibility()
+void LLVOAvatar::computeUpdatePeriod()
{
bool visually_muted = isVisuallyMuted();
- BOOL is_visible = isVisible(); // includes drawable check
- if ( is_visible
+ if (mDrawable.notNull()
+ && isVisible()
&& (!isSelf() || visually_muted)
&& !isUIAvatar()
&& sUseImpostors
@@ -3956,12 +3955,10 @@ BOOL LLVOAvatar::computeUpdatePeriodAndVisibility()
//nearby avatars, update the impostors more frequently.
mUpdatePeriod = 4;
}
- return (LLDrawable::getCurrentFrame() + mID.mData[0]) % mUpdatePeriod == 0 ? TRUE : FALSE;
}
else
{
mUpdatePeriod = 1;
- return is_visible;
}
}
@@ -4330,15 +4327,16 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// The rest should only be done occasionally for far away avatars.
// Set mUpdatePeriod and visible based on distance and other criteria.
//--------------------------------------------------------------------
- visible = computeUpdatePeriodAndVisibility();
+ computeUpdatePeriod();
+ bool needs_update = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0;
//--------------------------------------------------------------------
- // Early out if not visible and not self
+ // Early out if does not need update and not self
// don't early out for your own avatar, as we rely on your animations playing reliably
// for example, the "turn around" animation when entering customize avatar needs to trigger
// even when your avatar is offscreen
//--------------------------------------------------------------------
- if (!visible && !isSelf())
+ if (!needs_update && !isSelf())
{
updateMotions(LLCharacter::HIDDEN_UPDATE);
return FALSE;
@@ -4387,7 +4385,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
mSpeed = speed;
// update animations
- if (mSpecialRenderMode == 1) // Animation Preview
+ if (!visible)
+ {
+ updateMotions(LLCharacter::HIDDEN_UPDATE);
+ }
+ else if (mSpecialRenderMode == 1) // Animation Preview
{
updateMotions(LLCharacter::FORCE_UPDATE);
}
@@ -4421,10 +4423,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// Update child joints as needed.
mRoot->updateWorldMatrixChildren();
- // System avatar mesh vertices need to be reskinned.
- mNeedsSkin = TRUE;
+ if (visible)
+ {
+ // System avatar mesh vertices need to be reskinned.
+ mNeedsSkin = TRUE;
+ }
- return TRUE;
+ return visible;
}
//-----------------------------------------------------------------------------