From e0d6a6a40192caa5b9d62165da5f23a5ade6e4b0 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 19 Jun 2017 20:44:04 +0100
Subject: [PATCH] SL-725 - suppress default animations for LLControlAvatar,
 using a new mEnableDefaultAnimations field

---
 indra/newview/llcontrolavatar.cpp |  4 +++-
 indra/newview/llviewermessage.cpp |  1 -
 indra/newview/llvoavatar.cpp      | 30 ++++++++++++++++++++++++------
 indra/newview/llvoavatar.h        |  5 +++--
 4 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index 03a374ebdb1..8027ea9c733 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -30,6 +30,7 @@
 #include "llviewerobjectlist.h"
 #include "pipeline.h"
 #include "llanimationstates.h"
+#include "llviewercontrol.h"
 
 LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) :
     LLVOAvatar(id, pcode, regionp),
@@ -37,6 +38,7 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer
     mGlobalScale(1.0f)
 {
     mIsControlAvatar = true;
+    mEnableDefaultMotions = false;
 }
 
 // virtual
@@ -150,7 +152,7 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj)
 	cav->mSpecialRenderMode = 1;
 	cav->updateJointLODs();
 	cav->updateGeometry(cav->mDrawable);
-	cav->startMotion(ANIM_AGENT_STAND, 5.0f);
+	//cav->startMotion(ANIM_AGENT_STAND, 5.0f);
 	cav->hideSkirt();
 
 	// stop extraneous animations
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index f359c1455fa..df69d6d1979 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5113,7 +5113,6 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)
         avatarp->updateGeom(volp);
     }
 	avatarp->mSignaledAnimations.clear();
-    volp->setDebugText(llformat("Animations %d", num_blocks));
 	
     for( S32 i = 0; i < num_blocks; i++ )
     {
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 1c9f79b2009..c1331bf521d 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -665,7 +665,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mLastUpdateReceivedCOFVersion(-1),
 	mCachedMuteListUpdateTime(0),
 	mCachedInMuteList(false),
-    mIsControlAvatar(false)
+    mIsControlAvatar(false),
+    mEnableDefaultMotions(true)
 {
 	LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL;
 
@@ -1798,7 +1799,11 @@ void LLVOAvatar::buildCharacter()
 		mAahMorph = getVisualParam( "Express_Open_Mouth" );
 	}
 
-	startDefaultMotions();
+    // Currently disabled for control avatars (animated objects), enabled for all others.
+    if (mEnableDefaultMotions)
+    {
+        startDefaultMotions();
+    }
 
 	//-------------------------------------------------------------------------
 	// restart any currently active motions
@@ -3411,6 +3416,7 @@ void LLVOAvatar::updateDebugText()
 			addDebugText(mBakedTextureDebugText);
 	}
 
+    // Develop -> Avatar -> Animation Info
 	if (LLVOAvatar::sShowAnimationDebug)
 	{
 		for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin();
@@ -5042,7 +5048,10 @@ void LLVOAvatar::processAnimationStateChanges()
 	else if (mInAir && !mIsSitting)
 	{
 		stopMotion(ANIM_AGENT_WALK_ADJUST);
-		startMotion(ANIM_AGENT_FLY_ADJUST);
+        if (mEnableDefaultMotions)
+        {
+            startMotion(ANIM_AGENT_FLY_ADJUST);
+        }
 	}
 	else
 	{
@@ -5052,13 +5061,19 @@ void LLVOAvatar::processAnimationStateChanges()
 
 	if ( isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
 	{
-		startMotion(ANIM_AGENT_TARGET);
+        if (mEnableDefaultMotions)
+        {
+            startMotion(ANIM_AGENT_TARGET);
+        }
 		stopMotion(ANIM_AGENT_BODY_NOISE);
 	}
 	else
 	{
 		stopMotion(ANIM_AGENT_TARGET);
-		startMotion(ANIM_AGENT_BODY_NOISE);
+        if (mEnableDefaultMotions)
+        {
+            startMotion(ANIM_AGENT_BODY_NOISE);
+        }
 	}
 	
 	// clear all current animations
@@ -6670,7 +6685,10 @@ void LLVOAvatar::getOffObject()
 	mRoot->setRotation(cur_rotation_world);
 	mRoot->getXform()->update();
 
-	startMotion(ANIM_AGENT_BODY_NOISE);
+    if (mEnableDefaultMotions)
+    {
+        startMotion(ANIM_AGENT_BODY_NOISE);
+    }
 
 	if (isSelf())
 	{
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 2832f940f41..2b71cfbe61e 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -242,7 +242,7 @@ class LLVOAvatar :
 	// Updates
 	//--------------------------------------------------------------------
 public:
-	void			updateDebugText();
+	virtual void	updateDebugText();
 	virtual BOOL 	updateCharacter(LLAgent &agent);
 	void 			idleUpdateVoiceVisualizer(bool voice_enabled);
 	void 			idleUpdateMisc(bool detailed_update);
@@ -443,10 +443,11 @@ class LLVOAvatar :
 	VisualMuteSettings		mVisuallyMuteSetting;			// Always or never visually mute this AV
 
 	//--------------------------------------------------------------------
-	// NPC status
+	// animated object status
 	//--------------------------------------------------------------------
 public:
     bool mIsControlAvatar;
+    bool mEnableDefaultMotions;
 
 	//--------------------------------------------------------------------
 	// Morph masks
-- 
GitLab