From 0ca9b74516eb73e3b0943fce61fbd7473bd707c2 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 7 Jul 2017 20:23:51 +0100
Subject: SL-718 - start on support of animated objects as attachments.

---
 indra/newview/llcontrolavatar.cpp | 10 +++++++++-
 indra/newview/llvovolume.cpp      |  9 +++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index f18d1c636a..4aee5819aa 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -186,7 +186,15 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time)
 //virtual
 void LLControlAvatar::updateDebugText()
 {
-    addDebugText("I'm a control avatar");
+    S32 total_linkset_count = 0;
+    if (mRootVolp)
+    {
+        total_linkset_count = 1 + mRootVolp->getChildren().size();
+    }
+    std::vector<LLVOVolume*> volumes;
+    getAnimatedVolumes(volumes);
+    S32 animated_volume_count = volumes.size();
+    addDebugText(llformat("CAV obj %d anim %d", total_linkset_count, animated_volume_count));
 
     LLVOAvatar::updateDebugText();
 }
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 378a353f31..4065f9fc37 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3316,10 +3316,13 @@ bool LLVOVolume::canBeAnimatedObject() const
     {
         return false;
     }
+// AXON remove this check if animated object attachments are allowed
+#if 0
     if (isAttachment())
     {
         return false;
     }
+#endif
 	if (!getVolume())
 	{
 		return false;
@@ -3392,7 +3395,9 @@ void LLVOVolume::updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerO
     LLVOVolume *old_volp = dynamic_cast<LLVOVolume*>(old_parent);
     LLVOVolume *new_volp = dynamic_cast<LLVOVolume*>(new_parent);
 
-    if (new_parent)
+    // AXON - depending on whether animated objects can be attached,
+    // we may want to include or remove the isAvatar() check.
+    if (new_parent && !new_parent->isAvatar())
     {
         // Object should inherit control avatar and animated mesh flag
         // from parent, so clear them out from our own state
@@ -3407,7 +3412,7 @@ void LLVOVolume::updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerO
             av->markForDeath();
         }
         // If this succeeds now, it's because the new_parent is an animated object
-        if (isAnimatedObject())
+        if (isAnimatedObject() && getControlAvatar())
         {
             getControlAvatar()->addAttachmentOverridesForObject(this);
         }
-- 
cgit v1.2.3