summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-09-28 19:06:36 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-09-28 19:06:36 +0100
commit108fe6234488d9a383dea0be327af403487135f3 (patch)
tree7be757e94578624338b80352272c3bc669909229 /indra
parent2851793e670bbdff79f97534206bd3d7b4ae003d (diff)
SL-761, SL-718 - transform matrix munging for skeletons of animated object attachments, to allow editing to work correctly
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llcontrolavatar.cpp28
-rw-r--r--indra/newview/llviewerobject.cpp2
2 files changed, 13 insertions, 17 deletions
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index 7a8d5bce03..1e8bd0066b 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -68,6 +68,9 @@ void LLControlAvatar::matchVolumeTransform()
#endif
+ // Avatars seem to 90 degrees off from the rest of the world, this is a fixup.
+ LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1));
+
if (mRootVolp)
{
if (mRootVolp->isAttachment())
@@ -77,19 +80,15 @@ void LLControlAvatar::matchVolumeTransform()
{
LLViewerJointAttachment *attach = attached_av->getTargetAttachmentPoint(mRootVolp);
setPositionAgent(mRootVolp->getRenderPosition());
- // AXON why doesn't attach joint have a valid world
- // position? Using the parent as a kludge but not
- // right.
- //LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1));
- LLVector3 joint_pos = attach->getParent()->getWorldPosition();
- LLQuaternion joint_rot = attach->getParent()->getWorldRotation();
- //LLVector3 attach_pos = mRootVolp->mDrawable->getPosition();
- //attach_pos.rotVec(joint_rot);
- //LLQuaternion attach_rot = mRootVolp->mDrawable->getRotation();
- //mRoot->setWorldPosition(joint_pos + attach_pos);
- //mRoot->setWorldRotation(joint_rot * (attach_rot * ~fix_axes_rot));
- mRoot->setWorldPosition(joint_pos);
- mRoot->setWorldRotation(joint_rot);
+ attach->updateWorldPRSParent();
+ LLVector3 joint_pos = attach->getWorldPosition();
+ LLQuaternion joint_rot = attach->getWorldRotation();
+ LLVector3 obj_pos = mRootVolp->mDrawable->getPosition();
+ LLQuaternion obj_rot = mRootVolp->mDrawable->getRotation();
+ obj_pos.rotVec(joint_rot);
+ mRoot->setWorldPosition(obj_pos + joint_pos);
+ mRoot->setWorldRotation(fix_axes_rot * obj_rot * joint_rot);
+ setRotation(mRoot->getRotation());
}
else
{
@@ -99,9 +98,6 @@ void LLControlAvatar::matchVolumeTransform()
else
{
setPositionAgent(mRootVolp->getRenderPosition());
- //slamPosition();
-
- LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1));
LLQuaternion obj_rot = mRootVolp->getRotation();
LLQuaternion result_rot = fix_axes_rot * obj_rot;
setRotation(result_rot);
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 0140a63e73..99c68dab10 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -3981,7 +3981,7 @@ const LLVector3 LLViewerObject::getPivotPositionAgent() const
const LLQuaternion LLViewerObject::getRenderRotation() const
{
LLQuaternion ret;
- if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED))
+ if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED) && !isAnimatedObject())
{
return ret;
}