From 0243f0bc173e0f9d42d475a50201736a6fb0abbc Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 12 Feb 2024 02:26:11 -0500
Subject: [PATCH] Bonk in some fixes

---
 indra/newview/bdfloaterposer.cpp |  5 ++++-
 indra/newview/llvoavatar.cpp     | 10 +++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/indra/newview/bdfloaterposer.cpp b/indra/newview/bdfloaterposer.cpp
index 510036a67e0..de6c7a84ab2 100644
--- a/indra/newview/bdfloaterposer.cpp
+++ b/indra/newview/bdfloaterposer.cpp
@@ -280,6 +280,9 @@ void BDFloaterPoser::onClickPoseSave()
 {
 	//BD - Values don't matter when not editing.
 	onPoseSave(2, 0.1f, false);
+
+	//BD - Flash the poses button to give the user a visual cue where it went.
+	getChild<LLButton>("extend")->setFlashing(true, true);
 }
 
 void BDFloaterPoser::onPoseSave(S32 type, F32 time, bool editing)
@@ -412,7 +415,7 @@ void BDFloaterPoser::onPoseSave(S32 type, F32 time, bool editing)
 					//     as well as all attachment bones and collision volumes.
 					if (joint->mHasPosition || it > JOINTS)
 					{
-						vec3 = joint->getTargetPosition();
+						vec3 = it > JOINTS ? joint->getPosition() : joint->getTargetPosition();
 						record[line]["position"] = vec3.getValue();
 					}
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index e0274672f6a..f9de23c5c36 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2141,11 +2141,11 @@ void LLVOAvatar::resetSkeleton(bool reset_animations)
     }
 
 	//BD - We need to clear posing here otherwise we'll crash.
-	LLMotion* pose_motion = gAgentAvatarp->findMotion(ANIM_BD_POSING_MOTION);
+	LLMotion* pose_motion = findMotion(ANIM_BD_POSING_MOTION);
 	if (pose_motion)
 	{
 		gAgent.clearPosing();
-		gAgentAvatarp->removeMotion(ANIM_BD_POSING_MOTION);
+		removeMotion(ANIM_BD_POSING_MOTION);
 	}
 
     // Save mPelvis state
@@ -9777,7 +9777,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 
     bool slam_params = false;
 	applyParsedAppearanceMessage(*contents, slam_params);
-	if (getOverallAppearance() != AOA_NORMAL)
+	if (getOverallAppearance() != AOA_NORMAL && !getPosing())
 	{
 		resetSkeleton(false);
 	}
@@ -11533,7 +11533,7 @@ void LLVOAvatar::setOverallAppearanceNormal()
 		return;
 
     LLVector3 pelvis_pos = getJoint("mPelvis")->getPosition();
-	resetSkeleton(false);
+	if (!getPosing()) resetSkeleton(false);
     getJoint("mPelvis")->setPosition(pelvis_pos);
 
 	for (auto it = mJellyAnims.begin(); it !=  mJellyAnims.end(); ++it)
@@ -11573,7 +11573,7 @@ void LLVOAvatar::setOverallAppearanceJellyDoll()
 	updateOverallAppearanceAnimations();
 	
     LLVector3 pelvis_pos = getJoint("mPelvis")->getPosition();
-	resetSkeleton(false);
+	if (!getPosing()) resetSkeleton(false);
     getJoint("mPelvis")->setPosition(pelvis_pos);
 
 }
-- 
GitLab