diff options
author | Ansariel <none@none> | 2016-02-19 22:29:27 +0100 |
---|---|---|
committer | Ansariel <none@none> | 2016-02-19 22:29:27 +0100 |
commit | d7d4ffb0c4fda4e765a54115945a34eda28f9d1c (patch) | |
tree | f133c734567657860e3b94192616271be286421d | |
parent | 81d5e6e351e6cfd2e6c9b826a8e4dbca940463e0 (diff) |
Restore cached mute check for improved performance
-rwxr-xr-x | indra/newview/llviewerobject.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 29 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 5 |
3 files changed, 30 insertions, 6 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 2c111643ce..05d0d56832 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5046,7 +5046,7 @@ void LLViewerObject::updateText() LLVOAvatar* avatar = getAvatar(); if (avatar) { - mText->setHidden(LLMuteList::getInstance()->isMuted(avatar->getID())); + mText->setHidden(avatar->isInMuteList()); } LLVector3 up_offset(0,0,0); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8f94e608b1..12c1ff7611 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -717,7 +717,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), mLastUpdateRequestCOFVersion(-1), - mLastUpdateReceivedCOFVersion(-1) + mLastUpdateReceivedCOFVersion(-1), + mCachedMuteListUpdateTime(0), + mCachedInMuteList(false) { LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -2732,7 +2734,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } else { - is_muted = LLMuteList::getInstance()->isMuted(getID()); + is_muted = isInMuteList(); } bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); bool is_cloud = getIsCloud(); @@ -3086,7 +3088,7 @@ void LLVOAvatar::slamPosition() mRoot->updateWorldMatrixChildren(); } -bool LLVOAvatar::isVisuallyMuted() const +bool LLVOAvatar::isVisuallyMuted() { bool muted = false; @@ -3105,7 +3107,7 @@ bool LLVOAvatar::isVisuallyMuted() const { // Always want to see this AV as an impostor muted = true; } - else if (LLMuteList::getInstance()->isMuted(getID())) + else if (isInMuteList()) { muted = true; } @@ -3118,6 +3120,25 @@ bool LLVOAvatar::isVisuallyMuted() const return muted; } +bool LLVOAvatar::isInMuteList() +{ + bool muted = false; + F64 now = LLFrameTimer::getTotalSeconds(); + if (now < mCachedMuteListUpdateTime) + { + muted = mCachedInMuteList; + } + else + { + muted = LLMuteList::getInstance()->isMuted(getID()); + + const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1; + mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES; + mCachedInMuteList = muted; + } + return muted; +} + void LLVOAvatar::updateDebugText() { // clear debug text diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 75194bb8c5..10d10b2ed5 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -387,7 +387,8 @@ public: public: U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0); - bool isVisuallyMuted() const; + bool isVisuallyMuted(); + bool isInMuteList(); void forceUpdateVisualMuteSettings(); enum VisualMuteSettings @@ -426,6 +427,8 @@ public: mutable bool mVisualComplexityStale; U32 mReportedVisualComplexity; // from other viewers through the simulator + bool mCachedInMuteList; + F64 mCachedMuteListUpdateTime; VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV |