From b3ef02541253daf23dfc6aff70f831e91c4371e9 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 17 Sep 2015 15:33:04 +0300 Subject: MAINT-5570 [QuickGraphics] Visual complexity notifications are confusing. --- indra/newview/llattachmentsmgr.h | 5 +++ indra/newview/llavatarrendernotifier.cpp | 61 +++++++++++++++++++++++--------- indra/newview/llavatarrendernotifier.h | 2 +- indra/newview/llvoavatar.cpp | 11 ++++++ 4 files changed, 61 insertions(+), 18 deletions(-) diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h index d56d6eb27b..fab146cb52 100755 --- a/indra/newview/llattachmentsmgr.h +++ b/indra/newview/llattachmentsmgr.h @@ -87,6 +87,11 @@ public: void onDetachRequested(const LLUUID& inv_item_id); void onDetachCompleted(const LLUUID& inv_item_id); + bool hasPendingAttachments() { return mPendingAttachments.size() > 0; } + bool hasAttachmentRequests() { return mAttachmentRequests.size() > 0; } + bool hasDetachRequests() { return mAttachmentRequests.size() > 0; } + bool hasRecentlyArrivedAttachments() { return mRecentlyArrivedAttachments.size() > 0; } + private: class LLItemRequestTimes: public std::map diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 4ac36ec018..04689d2726 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -32,8 +32,9 @@ // std headers // external library headers // other Linden headers -#include "llagent.h" #include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llattachmentsmgr.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llnotificationtemplate.h" @@ -62,6 +63,7 @@ mLatestOverLimitPct(0.0f), mShowOverLimitAgents(false), mNotifyOutfitLoading(false) { + mPopUpDelayTimer.resetWithExpiry(OVER_LIMIT_UPDATE_DELAY); } std::string LLAvatarRenderNotifier::overLimitMessage() @@ -97,9 +99,10 @@ std::string LLAvatarRenderNotifier::overLimitMessage() return LLTrans::getString(message); } -void LLAvatarRenderNotifier::displayNotification() +void LLAvatarRenderNotifier::displayNotification(bool show_over_limit) { mAgentComplexity = mLatestAgentComplexity; + mShowOverLimitAgents = show_over_limit; static LLCachedControl expire_delay(gSavedSettings, "ShowMyComplexityChanges", 20); LLDate expire_date(LLDate::now().secondsSinceEpoch() + expire_delay); @@ -157,7 +160,7 @@ void LLAvatarRenderNotifier::updateNotificationRegion(U32 agentcount, U32 overLi if (mAgentsCount == mLatestAgentsCount && mOverLimitAgents == mLatestOverLimitAgents) { - //no changes since last notification + // no changes since last notification return; } @@ -167,9 +170,7 @@ void LLAvatarRenderNotifier::updateNotificationRegion(U32 agentcount, U32 overLi ) { // display in case of drop to/from zero and in case of significant (RENDER_ALLOWED_CHANGE_PCT) changes - - mShowOverLimitAgents = true; - displayNotification(); + displayNotification(true); // default timeout before next notification static LLCachedControl pop_up_delay(gSavedSettings, "ComplexityChangesPopUpDelay", 300); @@ -191,24 +192,51 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) if (!mNotifyOutfitLoading) { // We should not notify about initial outfit and it's load process without reason - if (isAgentAvatarValid() - && gAgent.isInitialized() - && gAgent.isOutfitChosen() + + if (!isAgentAvatarValid()) + { + return; + } + + static S32 initial_cof_version(-1); + static S32 rez_status(0); + + if (initial_cof_version < 0 && gAgentWearables.areWearablesLoaded() - && gAgentAvatarp->isFullyLoaded()) + && !LLAttachmentsMgr::getInstance()->hasPendingAttachments() + && !LLAttachmentsMgr::getInstance()->hasAttachmentRequests() + && !LLAttachmentsMgr::getInstance()->hasRecentlyArrivedAttachments()) { - // Initial outfit was fully loaded + // cof formed + initial_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + + // outfit might have been pre-loaded in one go, we are adding/removing items in such case + mNotifyOutfitLoading = gAgentAvatarp->isAllLocalTextureDataFinal(); + } + + if (initial_cof_version >= 0 && initial_cof_version != gAgentAvatarp->mLastUpdateRequestCOFVersion) + { + // version mismatch in comparison to initial outfit - outfit changed mNotifyOutfitLoading = true; } - else if (mLatestOverLimitAgents > 0 - || mAgentComplexity > mLatestAgentComplexity) + else if (mLatestOverLimitAgents > 0) { - // Some users can't see agent already or user switched outfits, - // this is a reason to show load process + // Some users can't see agent already, notify user about complexity growth mNotifyOutfitLoading = true; } + else if (gAgentAvatarp->mLastRezzedStatus >= rez_status) + { + rez_status = gAgentAvatarp->mLastRezzedStatus; + } else { + // rez status decreased - outfit related action was initiated + mNotifyOutfitLoading = true; + } + + if (!mNotifyOutfitLoading) + { + // avatar or outfit not ready mAgentComplexity = mLatestAgentComplexity; return; } @@ -217,8 +245,7 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) if (mAgentComplexity != mLatestAgentComplexity) { // if we have an agent complexity change, we always display it and hide 'over limit' - mShowOverLimitAgents = false; - displayNotification(); + displayNotification(false); // next 'over limit' update should be displayed after delay to make sure information got updated at server side mPopUpDelayTimer.resetWithExpiry(OVER_LIMIT_UPDATE_DELAY); diff --git a/indra/newview/llavatarrendernotifier.h b/indra/newview/llavatarrendernotifier.h index 509bc64b20..2949af2c01 100644 --- a/indra/newview/llavatarrendernotifier.h +++ b/indra/newview/llavatarrendernotifier.h @@ -40,7 +40,7 @@ class LLAvatarRenderNotifier : public LLSingleton public: LLAvatarRenderNotifier(); - void displayNotification(); + void displayNotification(bool show_over_limit); bool isNotificationVisible(); void updateNotificationRegion(U32 agentcount, U32 overLimit); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index edb447e497..60fd98b3d7 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6457,6 +6457,17 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) mPreviousFullyLoaded = mFullyLoaded; mFullyLoadedInitialized = TRUE; mFullyLoadedFrameCounter++; + + if (changed) + { + static LLCachedControl show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20); + + if (isSelf() && show_my_complexity_changes) + { + // to know about outfit switching + LLAvatarRenderNotifier::getInstance()->updateNotificationAgent(mVisualComplexity); + } + } return changed; } -- cgit v1.2.3 From e28f920f9a6525207418ed9d96aada256a1d8228 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 21 Sep 2015 15:48:02 +0300 Subject: MAINT-5570 Code refactoring --- indra/newview/llavatarrendernotifier.cpp | 71 +++++++++++++++++--------------- indra/newview/llavatarrendernotifier.h | 8 +++- indra/newview/llvoavatar.cpp | 11 ++--- 3 files changed, 48 insertions(+), 42 deletions(-) diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 04689d2726..ca3c1a7310 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -61,7 +61,10 @@ mLatestOverLimitAgents(0), mLatestAgentComplexity(0), mLatestOverLimitPct(0.0f), mShowOverLimitAgents(false), -mNotifyOutfitLoading(false) +mNotifyOutfitLoading(false), +mInitialCofVersion(-1), +mInitialOtfitRezStatus(-1), +mLastSkeletonSerialNum(-1) { mPopUpDelayTimer.resetWithExpiry(OVER_LIMIT_UPDATE_DELAY); } @@ -178,12 +181,41 @@ void LLAvatarRenderNotifier::updateNotificationRegion(U32 agentcount, U32 overLi } } +void LLAvatarRenderNotifier::updateNotificationState() +{ + if (!isAgentAvatarValid()) + { + // data not ready, nothing to show. + return; + } + + if (mInitialCofVersion < 0 + && gAgentWearables.areWearablesLoaded() + && !LLAttachmentsMgr::getInstance()->hasPendingAttachments() + && !LLAttachmentsMgr::getInstance()->hasAttachmentRequests() + && !LLAttachmentsMgr::getInstance()->hasRecentlyArrivedAttachments()) + { + // cof formed + mInitialCofVersion = LLAppearanceMgr::instance().getCOFVersion(); + mLastSkeletonSerialNum = gAgentAvatarp->mLastSkeletonSerialNum; + } + + if (gAgentAvatarp->mLastRezzedStatus >= mInitialOtfitRezStatus) + { + mInitialOtfitRezStatus = gAgentAvatarp->mLastRezzedStatus; + } + else + { + // rez status decreased - outfit related action was initiated + mNotifyOutfitLoading = true; + } +} void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) { // save the value for use in following messages mLatestAgentComplexity = agentComplexity; - if (!gAgentWearables.areWearablesLoaded()) + if (!isAgentAvatarValid() || !gAgentWearables.areWearablesLoaded()) { // data not ready, nothing to show. return; @@ -192,29 +224,11 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) if (!mNotifyOutfitLoading) { // We should not notify about initial outfit and it's load process without reason + updateNotificationState(); - if (!isAgentAvatarValid()) - { - return; - } - - static S32 initial_cof_version(-1); - static S32 rez_status(0); - - if (initial_cof_version < 0 - && gAgentWearables.areWearablesLoaded() - && !LLAttachmentsMgr::getInstance()->hasPendingAttachments() - && !LLAttachmentsMgr::getInstance()->hasAttachmentRequests() - && !LLAttachmentsMgr::getInstance()->hasRecentlyArrivedAttachments()) - { - // cof formed - initial_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - - // outfit might have been pre-loaded in one go, we are adding/removing items in such case - mNotifyOutfitLoading = gAgentAvatarp->isAllLocalTextureDataFinal(); - } - - if (initial_cof_version >= 0 && initial_cof_version != gAgentAvatarp->mLastUpdateRequestCOFVersion) + if (mInitialCofVersion >= 0 + && (mInitialCofVersion != gAgentAvatarp->mLastUpdateRequestCOFVersion + || mLastSkeletonSerialNum != gAgentAvatarp->mLastSkeletonSerialNum)) { // version mismatch in comparison to initial outfit - outfit changed mNotifyOutfitLoading = true; @@ -224,15 +238,6 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) // Some users can't see agent already, notify user about complexity growth mNotifyOutfitLoading = true; } - else if (gAgentAvatarp->mLastRezzedStatus >= rez_status) - { - rez_status = gAgentAvatarp->mLastRezzedStatus; - } - else - { - // rez status decreased - outfit related action was initiated - mNotifyOutfitLoading = true; - } if (!mNotifyOutfitLoading) { diff --git a/indra/newview/llavatarrendernotifier.h b/indra/newview/llavatarrendernotifier.h index 2949af2c01..3df8d38210 100644 --- a/indra/newview/llavatarrendernotifier.h +++ b/indra/newview/llavatarrendernotifier.h @@ -44,6 +44,7 @@ public: bool isNotificationVisible(); void updateNotificationRegion(U32 agentcount, U32 overLimit); + void updateNotificationState(); void updateNotificationAgent(U32 agentComplexity); private: @@ -67,8 +68,13 @@ private: F32 mLatestOverLimitPct; bool mShowOverLimitAgents; - bool mNotifyOutfitLoading; std::string overLimitMessage(); + + // initial outfit related variables (state control) + bool mNotifyOutfitLoading; + S32 mInitialCofVersion; + S32 mInitialOtfitRezStatus; + S32 mLastSkeletonSerialNum; }; #endif /* ! defined(LL_llavatarrendernotifier_H) */ diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 60fd98b3d7..3e20fbecdb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6458,15 +6458,10 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) mFullyLoadedInitialized = TRUE; mFullyLoadedFrameCounter++; - if (changed) + if (isSelf()) { - static LLCachedControl show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20); - - if (isSelf() && show_my_complexity_changes) - { - // to know about outfit switching - LLAvatarRenderNotifier::getInstance()->updateNotificationAgent(mVisualComplexity); - } + // to know about outfit switching + LLAvatarRenderNotifier::getInstance()->updateNotificationState(); } return changed; -- cgit v1.2.3 From 47dfdff3c0d684e78bd72d671a0d840798076a87 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 21 Sep 2015 20:36:21 +0300 Subject: MAINT-5570 limiting exposure of attachment manager --- indra/newview/llattachmentsmgr.cpp | 9 +++++++++ indra/newview/llattachmentsmgr.h | 5 +---- indra/newview/llavatarrendernotifier.cpp | 4 +--- indra/newview/llvoavatar.cpp | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 2a137cc39b..d3e66289d1 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -421,6 +421,15 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id) mQuestionableCOFLinks.addTime(inv_item_id); } +bool LLAttachmentsMgr::isAttachmentStateComplete() const +{ + return mPendingAttachments.empty() + && mAttachmentRequests.empty() + && mDetachRequests.empty() + && mRecentlyArrivedAttachments.empty() + && mQuestionableCOFLinks.empty(); +} + // Check for attachments that are (a) linked in COF and (b) not // attached to the avatar. This is a rotten function to have to // include, because it runs the risk of either repeatedly spamming out diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h index fab146cb52..bb7d35edbc 100755 --- a/indra/newview/llattachmentsmgr.h +++ b/indra/newview/llattachmentsmgr.h @@ -87,10 +87,7 @@ public: void onDetachRequested(const LLUUID& inv_item_id); void onDetachCompleted(const LLUUID& inv_item_id); - bool hasPendingAttachments() { return mPendingAttachments.size() > 0; } - bool hasAttachmentRequests() { return mAttachmentRequests.size() > 0; } - bool hasDetachRequests() { return mAttachmentRequests.size() > 0; } - bool hasRecentlyArrivedAttachments() { return mRecentlyArrivedAttachments.size() > 0; } + bool isAttachmentStateComplete() const; private: diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index ca3c1a7310..53be573461 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -191,9 +191,7 @@ void LLAvatarRenderNotifier::updateNotificationState() if (mInitialCofVersion < 0 && gAgentWearables.areWearablesLoaded() - && !LLAttachmentsMgr::getInstance()->hasPendingAttachments() - && !LLAttachmentsMgr::getInstance()->hasAttachmentRequests() - && !LLAttachmentsMgr::getInstance()->hasRecentlyArrivedAttachments()) + && LLAttachmentsMgr::getInstance()->isAttachmentStateComplete()) { // cof formed mInitialCofVersion = LLAppearanceMgr::instance().getCOFVersion(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3e20fbecdb..da02b96f80 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6458,7 +6458,7 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) mFullyLoadedInitialized = TRUE; mFullyLoadedFrameCounter++; - if (isSelf()) + if (changed && isSelf()) { // to know about outfit switching LLAvatarRenderNotifier::getInstance()->updateNotificationState(); -- cgit v1.2.3 From cfcc31c459b995caba88b99c48646e29f796a108 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 22 Sep 2015 17:21:06 +0300 Subject: MAINT-5570 additional comments, extended functionality of some variables --- indra/newview/llavatarrendernotifier.cpp | 33 ++++++++++++++++---------------- indra/newview/llavatarrendernotifier.h | 8 ++++++-- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 53be573461..d3bc135b4c 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -62,8 +62,8 @@ mLatestAgentComplexity(0), mLatestOverLimitPct(0.0f), mShowOverLimitAgents(false), mNotifyOutfitLoading(false), -mInitialCofVersion(-1), -mInitialOtfitRezStatus(-1), +mLastCofVersion(-1), +mLastOutfitRezStatus(-1), mLastSkeletonSerialNum(-1) { mPopUpDelayTimer.resetWithExpiry(OVER_LIMIT_UPDATE_DELAY); @@ -189,24 +189,32 @@ void LLAvatarRenderNotifier::updateNotificationState() return; } - if (mInitialCofVersion < 0 + // Don't use first provided COF and Sceleton versions - let them load anf 'form' first + if (mLastCofVersion < 0 && gAgentWearables.areWearablesLoaded() && LLAttachmentsMgr::getInstance()->isAttachmentStateComplete()) { // cof formed - mInitialCofVersion = LLAppearanceMgr::instance().getCOFVersion(); + mLastCofVersion = LLAppearanceMgr::instance().getCOFVersion(); mLastSkeletonSerialNum = gAgentAvatarp->mLastSkeletonSerialNum; } - - if (gAgentAvatarp->mLastRezzedStatus >= mInitialOtfitRezStatus) + else if (mLastCofVersion >= 0 + && (mLastCofVersion != gAgentAvatarp->mLastUpdateRequestCOFVersion + || mLastSkeletonSerialNum != gAgentAvatarp->mLastSkeletonSerialNum)) { - mInitialOtfitRezStatus = gAgentAvatarp->mLastRezzedStatus; + // version mismatch in comparison to previous outfit - outfit changed + mNotifyOutfitLoading = true; + mLastCofVersion = LLAppearanceMgr::instance().getCOFVersion(); + mLastSkeletonSerialNum = gAgentAvatarp->mLastSkeletonSerialNum; } - else + + if (gAgentAvatarp->mLastRezzedStatus < mLastOutfitRezStatus) { // rez status decreased - outfit related action was initiated mNotifyOutfitLoading = true; } + + mLastOutfitRezStatus = gAgentAvatarp->mLastRezzedStatus; } void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) { @@ -224,14 +232,7 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) // We should not notify about initial outfit and it's load process without reason updateNotificationState(); - if (mInitialCofVersion >= 0 - && (mInitialCofVersion != gAgentAvatarp->mLastUpdateRequestCOFVersion - || mLastSkeletonSerialNum != gAgentAvatarp->mLastSkeletonSerialNum)) - { - // version mismatch in comparison to initial outfit - outfit changed - mNotifyOutfitLoading = true; - } - else if (mLatestOverLimitAgents > 0) + if (mLatestOverLimitAgents > 0) { // Some users can't see agent already, notify user about complexity growth mNotifyOutfitLoading = true; diff --git a/indra/newview/llavatarrendernotifier.h b/indra/newview/llavatarrendernotifier.h index 3df8d38210..2a2704de28 100644 --- a/indra/newview/llavatarrendernotifier.h +++ b/indra/newview/llavatarrendernotifier.h @@ -72,9 +72,13 @@ private: // initial outfit related variables (state control) bool mNotifyOutfitLoading; - S32 mInitialCofVersion; - S32 mInitialOtfitRezStatus; + + // COF (inventory folder) and Skeleton (voavatar) are used to spot changes in outfit. + S32 mLastCofVersion; S32 mLastSkeletonSerialNum; + // Used to detect changes in voavatar's rezzed status. + // If value decreases - there were changes in outfit. + S32 mLastOutfitRezStatus; }; #endif /* ! defined(LL_llavatarrendernotifier_H) */ -- cgit v1.2.3