From ef0e3bfdd92bb5faea633a14487f123dfeb2f5f1 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 27 Oct 2017 21:27:36 +0100
Subject: [PATCH] SL-731, SL-779 - more diagnostics for DebugAnimatedObjects,
 fixed a problem with recursiveMarkForUpdate

---
 indra/newview/llcontrolavatar.cpp | 21 ++++++++++++++++++---
 indra/newview/llviewermessage.cpp | 22 +++++-----------------
 indra/newview/llviewerobject.cpp  | 11 +++++++++++
 indra/newview/llviewerobject.h    |  3 ++-
 indra/newview/llvovolume.cpp      |  4 ++--
 5 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index fab95ab1d8b..51dc7d7de1a 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -227,6 +227,7 @@ void LLControlAvatar::updateDebugText()
         getAnimatedVolumes(volumes);
         S32 animated_volume_count = volumes.size();
         std::string active_string;
+        std::string type_string;
         std::string lod_string;
         S32 total_tris = 0;
         S32 total_verts = 0;
@@ -248,16 +249,31 @@ void LLControlAvatar::updateDebugText()
                 {
                     active_string += "S";
                 }
+                if (volp->isRiggedMesh())
+                {
+                    // Rigged/animateable mesh
+                    type_string += "R";
+                }
+                else if (volp->isMesh())
+                {
+                    // Static mesh
+                    type_string += "M";
+                }
+                else
+                {
+                    // Any other prim
+                    type_string += "P";
+                }
             }
             else
             {
                 active_string += "-";
+                type_string += "-";
             }
         }
         addDebugText(llformat("CAV obj %d anim %d active %s",
                               total_linkset_count, animated_volume_count, active_string.c_str()));
-
-        addDebugText(llformat("lod %s",lod_string.c_str()));
+        addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str()));
         addDebugText(llformat("tris %d verts %d", total_tris, total_verts));
         //addDebugText(llformat("anim time %.1f (step %f factor %f)", 
         //                      mMotionController.getAnimTime(),
@@ -329,7 +345,6 @@ void LLControlAvatar::updateAnimations()
     }
     mSignaledAnimations = anims;
 
-    LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL;
     processAnimationStateChanges();
 }
 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index fad59aadf41..3834082f788 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5075,18 +5075,6 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
 	}
 }
 
-// AXON Move to llviewerobject
-void recursiveMarkForUpdate(LLViewerObject *vobj, BOOL priority)
-{
-    for (LLViewerObject::child_list_t::const_iterator iter = vobj->getChildren().begin();
-         iter != vobj->getChildren().end(); iter++)
-    {
-        LLViewerObject* child = (LLViewerObject*)*iter;
-        child->markForUpdate(priority);
-    }
-    vobj->markForUpdate(priority);
-}
-
 void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
 {
 	LLUUID	animation_id;
@@ -5123,14 +5111,14 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
     }
     
 	S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList);
-	LL_DEBUGS("AXON") << "handle object animation here, num_blocks " << num_blocks << LL_ENDL;
+	LL_DEBUGS("AXON") << "processing object animation requests, num_blocks " << num_blocks << LL_ENDL;
 
-#if 1 
+#if 0 
     if (!avatarp->mPlaying)
     {
         avatarp->mPlaying = true;
 		avatarp->updateVolumeGeom();
-        recursiveMarkForUpdate(avatarp->mRootVolp,TRUE);
+        avatarp->mRootVolp->recursiveMarkForUpdate(TRUE);
     }
 #else
     if (num_blocks > 0 && !avatarp->mPlaying)
@@ -5138,7 +5126,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
         avatarp->mPlaying = true;
 		avatarp->updateVolumeGeom();
         // AXON FIXME need to update all objects in the linkset, not just the one where animation is playing
-        recursiveMarkForUpdate(avatarp->mRootVolp,TRUE);
+        avatarp->mRootVolp->recursiveMarkForUpdate(TRUE);
     }
     else if (num_blocks == 0 && avatarp->mPlaying)
     {
@@ -5148,7 +5136,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
         avatarp->mPlaying = false;
 		avatarp->updateVolumeGeom();
         // AXON FIXME need to update all objects in the linkset, not just the one where animation is playing
-        recursiveMarkForUpdate(avatarp->mRootVolp,TRUE);
+        avatarp->mRootVolp->recursiveMarkForUpdate(TRUE);
     }
 #endif
 
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 8e50f2dc089..b17d83486fe 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -6020,6 +6020,17 @@ void LLViewerObject::updateVolume(const LLVolumeParams& volume_params)
 	}
 }
 
+void LLViewerObject::recursiveMarkForUpdate(BOOL priority)
+{
+    for (LLViewerObject::child_list_t::iterator iter = mChildList.begin();
+         iter != mChildList.end(); iter++)
+    {
+        LLViewerObject* child = *iter;
+        child->markForUpdate(priority);
+    }
+    markForUpdate(priority);
+}
+
 void LLViewerObject::markForUpdate(BOOL priority)
 {
 	if (mDrawable.notNull())
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 09b87e4a3a5..a3a9a075bab 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -419,7 +419,8 @@ class LLViewerObject
 	void setIcon(LLViewerTexture* icon_image);
 	void clearIcon();
 
-	void markForUpdate(BOOL priority);
+    void recursiveMarkForUpdate(BOOL priority);
+	virtual void markForUpdate(BOOL priority);
 	void updateVolume(const LLVolumeParams& volume_params);
 	virtual	void updateSpatialExtents(LLVector4a& min, LLVector4a& max);
 	virtual F32 getBinRadius();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index d4a601d3943..004f335a5ac 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3403,7 +3403,7 @@ bool LLVOVolume::canBeAnimatedObject() const
     F32 est_tris = recursiveGetEstTrianglesMax();
     if (est_tris <= 0 || est_tris > getAnimatedObjectMaxTris())
     {
-        LL_INFOS() << "est_tris " << est_tris << " is outside limit of 1-" << getAnimatedObjectMaxTris() << LL_ENDL;
+        LL_DEBUGS("AXON") << "est_tris " << est_tris << " is outside limit of 1-" << getAnimatedObjectMaxTris() << LL_ENDL;
         return false;
     }
     return true;
@@ -3987,7 +3987,7 @@ void LLVOVolume::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_u
         bool was_enabled = (getControlAvatar() != NULL);
         if (enabled != was_enabled)
         {
-            LL_INFOS() << (U32) this
+            LL_DEBUGS("AXON") << (U32) this
                        << " calling onSetExtendedMeshFlags, enabled " << (U32) enabled
                        << " was_enabled " << (U32) was_enabled
                        << " local_origin " << (U32) local_origin
-- 
GitLab