From 7d46d6fb21c21092b7dcaa3357a0698bf9d44794 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 14 May 2020 20:37:36 +0300 Subject: [PATCH 1/3] SL-12026 Fix issue with constant bridge recreation for animeshes --- indra/newview/lldrawable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ad19574b44..2219f20272 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1182,7 +1182,8 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() { U32 partition_type = mSpatialBridge->asPartition()->mPartitionType; bool is_hud = mVObjp->isHUDAttachment(); - bool is_attachment = mVObjp->isAttachment() && !is_hud; + bool is_animesh = mVObjp->isAnimatedObject() && mVObjp->getControlAvatar() != NULL; + bool is_attachment = mVObjp->isAttachment() && !is_hud && !is_animesh; if ((partition_type == LLViewerRegion::PARTITION_HUD) != is_hud) { // Was/became HUD @@ -1190,7 +1191,7 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() mSpatialBridge->markDead(); setSpatialBridge(NULL); } - else if ((partition_type == LLViewerRegion::PARTITION_CONTROL_AV) != (mVObjp->isAnimatedObject() && mVObjp->getControlAvatar() != NULL)) + else if ((partition_type == LLViewerRegion::PARTITION_CONTROL_AV) != is_animesh) { // Was/became part of animesh // remove obsolete bridge From a21c0bd128a8c34c90c8fd0a128c608a92959fca Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 14 May 2020 22:55:33 +0300 Subject: [PATCH 2/3] SL-12237 Remade updates for invisible avatars --- indra/newview/llvoavatar.cpp | 33 +++++++++++++++++++-------------- indra/newview/llvoavatar.h | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 724af3c8ed..55256746e6 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 ? TRUE : FALSE; //-------------------------------------------------------------------- - // 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; } //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index cb91c55ba0..4e728ac959 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -264,7 +264,7 @@ public: virtual void updateDebugText(); virtual BOOL updateCharacter(LLAgent &agent); void updateFootstepSounds(); - BOOL computeUpdatePeriodAndVisibility(); + void computeUpdatePeriod(); void updateOrientation(LLAgent &agent, F32 speed, F32 delta_time); void updateTimeStep(); void updateRootPositionAndRotation(LLAgent &agent, F32 speed, bool was_sit_ground_constrained);