From cfcc31c459b995caba88b99c48646e29f796a108 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
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