diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llavatarrendernotifier.cpp | 106 | ||||
-rw-r--r-- | indra/newview/llavatarrendernotifier.h | 1 |
2 files changed, 41 insertions, 66 deletions
diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index da8bfae1a9..a0e3e86eea 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -99,6 +99,7 @@ std::string LLAvatarRenderNotifier::overLimitMessage() void LLAvatarRenderNotifier::displayNotification() { + mAgentComplexity = mLatestAgentComplexity; static LLCachedControl<U32> expire_delay(gSavedSettings, "ShowMyComplexityChanges", 20); LLDate expire_date(LLDate::now().secondsSinceEpoch() + expire_delay); @@ -107,6 +108,10 @@ void LLAvatarRenderNotifier::displayNotification() std::string notification_name; if (mShowOverLimitAgents) { + mAgentsCount = mLatestAgentsCount; + mOverLimitAgents = mLatestOverLimitAgents; + mOverLimitPct = mLatestOverLimitPct; + std::string notification_message = overLimitMessage(); notification_name = "RegionAndAgentComplexity"; args["OVERLIMIT_MSG"] = notification_message; @@ -134,69 +139,6 @@ bool LLAvatarRenderNotifier::isNotificationVisible() return mNotificationPtr != NULL && mNotificationPtr->isActive(); } -void LLAvatarRenderNotifier::updateNotification() -{ - if (mAgentsCount == mLatestAgentsCount - && mOverLimitAgents == mLatestOverLimitAgents - && mAgentComplexity == mLatestAgentComplexity) - { - //no changes since last notification - return; - } - - if (mLatestAgentComplexity == 0 - || !gAgentWearables.areWearablesLoaded()) - { - // data not ready, nothing to show. - return; - } - - bool display_notification = false; - bool is_visible = isNotificationVisible(); - - if (mLatestOverLimitPct > 0 || mOverLimitPct > 0) - { - //include 'over limit' information into notification - mShowOverLimitAgents = true; - } - else - { - // make sure that 'over limit' won't be displayed only to be hidden in a second - mShowOverLimitAgents &= is_visible; - } - - if (mAgentComplexity != mLatestAgentComplexity) - { - // if we have an agent complexity update, we always display it - display_notification = true; - - // next 'over limit' update should be displayed after delay to make sure information got updated at server side - mPopUpDelayTimer.resetWithExpiry(OVER_LIMIT_UPDATE_DELAY); - } - else if ( (mPopUpDelayTimer.hasExpired() || is_visible) - && (mOverLimitPct > 0 || mLatestOverLimitPct > 0) - && std::abs(mOverLimitPct - mLatestOverLimitPct) > mLatestOverLimitPct * RENDER_ALLOWED_CHANGE_PCT - ) - { - // display in case of drop to/from zero and in case of significant (RENDER_ALLOWED_CHANGE_PCT) changes - display_notification = true; - - // default timeout before next notification - static LLCachedControl<U32> pop_up_delay(gSavedSettings, "ComplexityChangesPopUpDelay", 300); - mPopUpDelayTimer.resetWithExpiry(pop_up_delay); - } - - if (display_notification) - { - mAgentComplexity = mLatestAgentComplexity; - mAgentsCount = mLatestAgentsCount; - mOverLimitAgents = mLatestOverLimitAgents; - mOverLimitPct = mLatestOverLimitPct; - - displayNotification(); - } -} - void LLAvatarRenderNotifier::updateNotificationRegion(U32 agentcount, U32 overLimit) { if (agentcount == 0) @@ -210,7 +152,27 @@ void LLAvatarRenderNotifier::updateNotificationRegion(U32 agentcount, U32 overLi mLatestOverLimitAgents = overLimit; mLatestOverLimitPct = mLatestAgentsCount != 0 ? ((F32)overLimit / (F32)mLatestAgentsCount) * 100.0 : 0; - updateNotification(); + if (mAgentsCount == mLatestAgentsCount + && mOverLimitAgents == mLatestOverLimitAgents) + { + //no changes since last notification + return; + } + + if ((mPopUpDelayTimer.hasExpired() || (isNotificationVisible() && mShowOverLimitAgents)) + && (mOverLimitPct > 0 || mLatestOverLimitPct > 0) + && std::abs(mOverLimitPct - mLatestOverLimitPct) > mLatestOverLimitPct * RENDER_ALLOWED_CHANGE_PCT + ) + { + // display in case of drop to/from zero and in case of significant (RENDER_ALLOWED_CHANGE_PCT) changes + + mShowOverLimitAgents = true; + displayNotification(); + + // default timeout before next notification + static LLCachedControl<U32> pop_up_delay(gSavedSettings, "ComplexityChangesPopUpDelay", 300); + mPopUpDelayTimer.resetWithExpiry(pop_up_delay); + } } void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) @@ -218,6 +180,12 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) // save the value for use in following messages mLatestAgentComplexity = agentComplexity; + if (!gAgentWearables.areWearablesLoaded()) + { + // data not ready, nothing to show. + return; + } + if (!mNotifyOutfitLoading) { // We should not notify about initial outfit and it's load process without reason @@ -244,6 +212,14 @@ void LLAvatarRenderNotifier::updateNotificationAgent(U32 agentComplexity) } } - updateNotification(); + if (mAgentComplexity != mLatestAgentComplexity) + { + // if we have an agent complexity change, we always display it and hide 'over limit' + mShowOverLimitAgents = false; + displayNotification(); + + // 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 20fcc5d277..509bc64b20 100644 --- a/indra/newview/llavatarrendernotifier.h +++ b/indra/newview/llavatarrendernotifier.h @@ -43,7 +43,6 @@ public: void displayNotification(); bool isNotificationVisible(); - void updateNotification(); void updateNotificationRegion(U32 agentcount, U32 overLimit); void updateNotificationAgent(U32 agentComplexity); |