From c7a0b25977a5ca30fc1726370f6363349ff9f836 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 8 Nov 2017 19:56:09 +0000
Subject: [PATCH] SL-831 - animesh objects are not required to have any tris.
 If they have no tris, we don't bother making a control avatar for them.

---
 indra/newview/llselectmgr.cpp |  3 ++-
 indra/newview/llvovolume.cpp  | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index e8b2d1ec8c5..f666f447cb8 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -691,7 +691,7 @@ bool LLSelectMgr::enableLinkObjects()
 			new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
 		}
 	}
-    if (!LLSelectMgr::getInstance()->getSelection()->checkAnimatedObjectLinkable())
+    if (!LLSelectMgr::getInstance()->getSelection()->checkAnimatedObjectEstTris())
     {
         new_value = false;
     }
@@ -7451,6 +7451,7 @@ bool LLObjectSelection::checkAnimatedObjectEstTris()
 
 bool LLObjectSelection::checkAnimatedObjectLinkable()
 {
+    LL_ERRS() << "Not using this restriction" << LL_ENDL;
     // Can't link if any of the roots is currently an animated object
 	for (root_iterator iter = root_begin(); iter != root_end(); ++iter)
 	{
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 9d988220827..54029f75fdf 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3410,9 +3410,9 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags)
 bool LLVOVolume::canBeAnimatedObject() const
 {
     F32 est_tris = recursiveGetEstTrianglesMax();
-    if (est_tris <= 0 || est_tris > getAnimatedObjectMaxTris())
+    if (est_tris < 0 || est_tris > getAnimatedObjectMaxTris())
     {
-        LL_DEBUGS("AXON") << "est_tris " << est_tris << " is outside limit of 1-" << getAnimatedObjectMaxTris() << LL_ENDL;
+        LL_DEBUGS("AXON") << "est_tris " << est_tris << " is outside limit of 0-" << getAnimatedObjectMaxTris() << LL_ENDL;
         return false;
     }
     return true;
@@ -5138,8 +5138,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
             {
                 if (!vobj->getControlAvatar())
                 {
-                    LL_DEBUGS("AXON") << vobj_name << " calling linkControlAvatar()" << LL_ENDL;
-                    vobj->linkControlAvatar();
+                    F32 tri_count = vobj->getRootEdit()->recursiveGetEstTrianglesMax();
+                    if (tri_count <= 0.f)
+                    {
+                        LL_DEBUGS("AXON") << vobj_name << " not calling linkControlAvatar(), because no tris" << LL_ENDL;
+                    }
+                    else
+                    {
+                        LL_DEBUGS("AXON") << vobj_name << " calling linkControlAvatar()" << LL_ENDL;
+                        vobj->linkControlAvatar();
+                    }
                 }
                 if (vobj->getControlAvatar())
                 {
-- 
GitLab