From ee464c2f1607d689bd7cefe2bf8921332e651a52 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Tue, 26 Jun 2018 14:19:26 +0100
Subject: [PATCH] MAINT-8790 - ignore control avatars when fetching or sending
 complexity stats.

---
 indra/newview/llavatarrenderinfoaccountant.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp
index 7c7f55f68c6..ca83afb5ab0 100644
--- a/indra/newview/llavatarrenderinfoaccountant.cpp
+++ b/indra/newview/llavatarrenderinfoaccountant.cpp
@@ -112,8 +112,13 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64
                  )
             {
                 LLUUID target_agent_id = LLUUID(agent_iter->first);
-                LLViewerObject* avatarp = gObjectList.findObject(target_agent_id);
-                if (avatarp && avatarp->isAvatar())
+                LLViewerObject* vobjp = gObjectList.findObject(target_agent_id);
+                LLVOAvatar *avatarp = NULL;
+                if (vobjp)
+                {
+                    avatarp = vobjp->asAvatar();
+                }
+                if (avatarp && !avatarp->isControlAvatar())
                 {
                     const LLSD & agent_info_map = agent_iter->second;
                     if (agent_info_map.isMap())
@@ -123,7 +128,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64
 
                         if (agent_info_map.has(KEY_WEIGHT))
                         {
-                            ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger());
+                            avatarp->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger());
                         }
                     }
                     else
@@ -201,6 +206,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
         if (avatar &&
             avatar->getRezzedStatus() >= 2 &&					// Mostly rezzed (maybe without baked textures downloaded)
             !avatar->isDead() &&								// Not dead yet
+            !avatar->isControlAvatar() &&						// Not part of an animated object
             avatar->getObjectHost() == regionp->getHost())		// Ensure it's on the same region
         {
             avatar->calculateUpdateRenderComplexity();			// Make sure the numbers are up-to-date
-- 
GitLab