From 5a2133455b939b646187fe2c714ff1ddf323326f Mon Sep 17 00:00:00 2001 From: Angeldark Raymaker Date: Sun, 22 Sep 2024 00:15:18 +0100 Subject: [PATCH] FIRE-30873: Update joint stop/start/recapture --- indra/newview/bdposingmotion.cpp | 19 ++++++++++++++----- indra/newview/bdposingmotion.h | 7 +++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/indra/newview/bdposingmotion.cpp b/indra/newview/bdposingmotion.cpp index 618113ad04..010a782e13 100644 --- a/indra/newview/bdposingmotion.cpp +++ b/indra/newview/bdposingmotion.cpp @@ -183,9 +183,6 @@ bool BDPosingMotion::onUpdate(F32 time, U8* joint_mask) void BDPosingMotion::onDeactivate() {} -/// -/// Adds the supplied joint to the current animation. -/// void BDPosingMotion::addJointToState(LLJoint *joint) { setJointState(joint, LLJointState::POS | LLJointState::ROT); } void BDPosingMotion::removeJointFromState(LLJoint *joint) { setJointState(joint, 0); } @@ -195,13 +192,21 @@ void BDPosingMotion::setJointState(LLJoint *joint, U32 state) if (!joint) return; + LLPose* pose = this->getPose(); + if (!pose) + return; + + LLPointer jointState = pose->findJointState(joint); + if (jointState.isNull()) + return; + + pose->removeJointState(jointState); + S32 jointNumber = joint->getJointNum(); if (jointNumber < 0 || jointNumber >= _numberOfBonesApropoOfNothing) return; - mJointState[jointNumber]->setJoint(joint); mJointState[jointNumber]->setUsage(state); - addJointState(mJointState[jointNumber]); } @@ -210,6 +215,10 @@ bool BDPosingMotion::currentlyPosingJoint(LLJoint* joint) if (!joint) return false; + LLJointState* jointState = mPose.findJointState(joint); + if (!jointState) + return false; + S32 jointNumber = joint->getJointNum(); if (jointNumber < 0 || jointNumber >= _numberOfBonesApropoOfNothing) return false; diff --git a/indra/newview/bdposingmotion.h b/indra/newview/bdposingmotion.h index eb95304317..8bd871ac8c 100644 --- a/indra/newview/bdposingmotion.h +++ b/indra/newview/bdposingmotion.h @@ -97,14 +97,17 @@ public: /// The joint to stop animating. void removeJointFromState(LLJoint *joint); - void setJointState(LLJoint *joint, U32 state); - /// /// Queries whether the supplied joint is being animated. /// /// The joint to query. bool currentlyPosingJoint(LLJoint *joint); + /// + /// Removes the current joint state, and adds a new one. + /// + void setJointState(LLJoint* joint, U32 state); + private: static const S32 _numberOfBonesApropoOfNothing = 134;