diff --git a/indra/newview/fsfloaterposer.cpp b/indra/newview/fsfloaterposer.cpp
index 44b250f73b..50cf23f482 100644
--- a/indra/newview/fsfloaterposer.cpp
+++ b/indra/newview/fsfloaterposer.cpp
@@ -576,8 +576,8 @@ void FSFloaterPoser::onClickRecaptureSelectedBones()
LLVector3 newRotation = _poserAnimator.getJointRotation(avatar, *item, getJointTranslation(item->jointName()),
getJointNegation(item->jointName()), true);
- LLVector3 newPosition = _poserAnimator.getJointPosition(avatar, *item);
- LLVector3 newScale = _poserAnimator.getJointScale(avatar, *item);
+ LLVector3 newPosition = _poserAnimator.getJointPosition(avatar, *item, true);
+ LLVector3 newScale = _poserAnimator.getJointScale(avatar, *item, true);
_poserAnimator.setPosingAvatarJoint(avatar, *item, true);
diff --git a/indra/newview/fsposeranimator.cpp b/indra/newview/fsposeranimator.cpp
index fd7f34314c..8efda4d745 100644
--- a/indra/newview/fsposeranimator.cpp
+++ b/indra/newview/fsposeranimator.cpp
@@ -341,7 +341,7 @@ void FSPoserAnimator::redoLastJointScale(LLVOAvatar* avatar, FSPoserJoint joint,
oppositeJointPose->redoLastScaleSet();
}
-LLVector3 FSPoserAnimator::getJointPosition(LLVOAvatar *avatar, FSPoserJoint joint)
+LLVector3 FSPoserAnimator::getJointPosition(LLVOAvatar* avatar, FSPoserJoint joint, bool forRecapture)
{
LLVector3 pos;
if (!isAvatarSafeToUse(avatar))
@@ -355,7 +355,10 @@ LLVector3 FSPoserAnimator::getJointPosition(LLVOAvatar *avatar, FSPoserJoint joi
if (!jointPose)
return pos;
- pos = jointPose->getTargetPosition();
+ if (forRecapture)
+ pos = jointPose->getCurrentPosition();
+ else
+ pos = jointPose->getTargetPosition();
return pos;
}
@@ -415,27 +418,19 @@ LLVector3 FSPoserAnimator::getJointRotation(LLVOAvatar *avatar, FSPoserJoint joi
if (!isAvatarSafeToUse(avatar))
return vec3;
+ FSPosingMotion* posingMotion = getPosingMotion(avatar);
+ if (!posingMotion)
+ return vec3;
+
+ FSPosingMotion::FSJointPose* jointPose = posingMotion->getJointPoseByJointName(joint.jointName());
+ if (!jointPose)
+ return vec3;
+
LLQuaternion rot;
if (forRecapture)
- {
- LLJoint* avJoint = avatar->getJoint(JointKey::construct(joint.jointName()));
- if (!avJoint)
- return vec3;
-
- rot = avJoint->getRotation();
- }
+ rot = jointPose->getCurrentRotation();
else
- {
- FSPosingMotion* posingMotion = getPosingMotion(avatar);
- if (!posingMotion)
- return vec3;
-
- FSPosingMotion::FSJointPose* jointPose = posingMotion->getJointPoseByJointName(joint.jointName());
- if (!jointPose)
- return vec3;
-
rot = jointPose->getTargetRotation();
- }
return translateRotationFromQuaternion(translation, negation, rot);
}
@@ -650,7 +645,7 @@ LLVector3 FSPoserAnimator::translateRotationFromQuaternion(E_BoneAxisTranslation
return vec3;
}
-LLVector3 FSPoserAnimator::getJointScale(LLVOAvatar *avatar, FSPoserJoint joint)
+LLVector3 FSPoserAnimator::getJointScale(LLVOAvatar* avatar, FSPoserJoint joint, bool forRecapture)
{
LLVector3 scale;
if (!isAvatarSafeToUse(avatar))
@@ -664,7 +659,10 @@ LLVector3 FSPoserAnimator::getJointScale(LLVOAvatar *avatar, FSPoserJoint joint)
if (!jointPose)
return scale;
- scale = jointPose->getTargetScale();
+ if (forRecapture)
+ scale = jointPose->getCurrentScale();
+ else
+ scale = jointPose->getTargetScale();
return scale;
}
diff --git a/indra/newview/fsposeranimator.h b/indra/newview/fsposeranimator.h
index 09a75651aa..ea8f964ee3 100644
--- a/indra/newview/fsposeranimator.h
+++ b/indra/newview/fsposeranimator.h
@@ -334,7 +334,7 @@ public:
/// The avatar whose joint is being queried.
/// The joint to determine the position for.
/// The position of the requested joint, if determinable, otherwise a default vector.
- LLVector3 getJointPosition(LLVOAvatar *avatar, FSPoserJoint joint);
+ LLVector3 getJointPosition(LLVOAvatar* avatar, FSPoserJoint joint, bool forRecapture = false);
///
/// Sets the position of a joint for the supplied avatar.
@@ -374,7 +374,7 @@ public:
/// The avatar whose joint is being queried.
/// The joint to determine the scale for.
/// The scale of the requested joint, if determinable, otherwise a default vector.
- LLVector3 getJointScale(LLVOAvatar *avatar, FSPoserJoint joint);
+ LLVector3 getJointScale(LLVOAvatar* avatar, FSPoserJoint joint, bool forRecapture = false);
///
/// Sets the scale of a joint for the supplied avatar.
diff --git a/indra/newview/fsposingmotion.h b/indra/newview/fsposingmotion.h
index cdfaa3f7ff..95229b015e 100644
--- a/indra/newview/fsposingmotion.h
+++ b/indra/newview/fsposingmotion.h
@@ -173,6 +173,20 @@ public:
///
LLVector3 getTargetPosition() const { return _targetPosition; }
+ ///
+ /// Gets the position the animator wishes the joint to be in.
+ ///
+ LLVector3 getCurrentPosition()
+ {
+ LLVector3 vec3;
+ LLJoint* joint = _jointState->getJoint();
+ if (!joint)
+ return vec3;
+
+ vec3 = joint->getPosition();
+ return vec3;
+ }
+
///
/// Sets the position the animator wishes the joint to be in.
///
@@ -196,6 +210,20 @@ public:
///
LLQuaternion getTargetRotation() const { return _targetRotation; }
+ ///
+ /// Gets the rotation of the joint.
+ ///
+ LLQuaternion getCurrentRotation()
+ {
+ LLQuaternion quat;
+ LLJoint* joint = _jointState->getJoint();
+ if (!joint)
+ return quat;
+
+ quat = joint->getRotation();
+ return quat;
+ }
+
///
/// Sets the rotation the animator wishes the joint to be in.
///
@@ -214,6 +242,20 @@ public:
///
LLVector3 getTargetScale() const { return _targetScale; }
+ ///
+ /// Gets the scale the joint has.
+ ///
+ LLVector3 getCurrentScale()
+ {
+ LLVector3 vec3;
+ LLJoint* joint = _jointState->getJoint();
+ if (!joint)
+ return vec3;
+
+ vec3 = joint->getScale();
+ return vec3;
+ }
+
///
/// Gets the scale the joint had when the animation was initialized.
///