FIRE-30873: Update joint stop/start/recapture

meow-7.2.2
Angeldark Raymaker 2024-09-22 00:15:18 +01:00
parent 409459da6a
commit 5a2133455b
2 changed files with 19 additions and 7 deletions

View File

@ -183,9 +183,6 @@ bool BDPosingMotion::onUpdate(F32 time, U8* joint_mask)
void BDPosingMotion::onDeactivate() {}
/// <summary>
/// Adds the supplied joint to the current animation.
/// </summary>
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<LLJointState> 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;

View File

@ -97,14 +97,17 @@ public:
/// <param name="joint">The joint to stop animating.</param>
void removeJointFromState(LLJoint *joint);
void setJointState(LLJoint *joint, U32 state);
/// <summary>
/// Queries whether the supplied joint is being animated.
/// </summary>
/// <param name="joint">The joint to query.</param>
bool currentlyPosingJoint(LLJoint *joint);
/// <summary>
/// Removes the current joint state, and adds a new one.
/// </summary>
void setJointState(LLJoint* joint, U32 state);
private:
static const S32 _numberOfBonesApropoOfNothing = 134;