From 27685e04259aff90150e8a2de9ef8e2b64a9113a Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 20 Nov 2015 09:33:57 -0800 Subject: [PATCH] Bug fixes for other Avatar root translation --- libraries/animation/src/AvatarRig.cpp | 5 +++-- libraries/animation/src/EntityRig.cpp | 11 +++++++---- libraries/animation/src/Rig.cpp | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libraries/animation/src/AvatarRig.cpp b/libraries/animation/src/AvatarRig.cpp index 148f4115f1..0082acf03d 100644 --- a/libraries/animation/src/AvatarRig.cpp +++ b/libraries/animation/src/AvatarRig.cpp @@ -11,6 +11,7 @@ #include "AvatarRig.h" +// AJT: REMOVE, this should no longer be used void AvatarRig::setHandPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation, float scale, float priority) { @@ -90,7 +91,7 @@ void AvatarRig::setJointTranslation(int index, bool valid, const glm::vec3& tran } } - if (index > 0 && index < (int)_overrideFlags.size()) { + if (index >= 0 && index < (int)_overrideFlags.size()) { if (valid) { assert(_overrideFlags.size() == _overridePoses.size()); _overrideFlags[index] = true; @@ -116,7 +117,7 @@ void AvatarRig::setJointState(int index, bool valid, const glm::quat& rotation, } } - if (index > 0 && index < (int)_overrideFlags.size()) { + if (index >= 0 && index < (int)_overrideFlags.size()) { assert(_overrideFlags.size() == _overridePoses.size()); _overrideFlags[index] = true; _overridePoses[index].rot = rotation; diff --git a/libraries/animation/src/EntityRig.cpp b/libraries/animation/src/EntityRig.cpp index 9667fc569f..ff89c9d50b 100644 --- a/libraries/animation/src/EntityRig.cpp +++ b/libraries/animation/src/EntityRig.cpp @@ -12,10 +12,9 @@ #include "EntityRig.h" void EntityRig::setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority) { - if (index != -1 && index < _jointStates.size()) { - - // AJT: LEGACY - { + // AJT: LEGACY + { + if (index != -1 && index < _jointStates.size()) { JointState& state = _jointStates[index]; if (valid) { state.setRotationInConstrainedFrame(rotation, priority); @@ -25,8 +24,12 @@ void EntityRig::setJointState(int index, bool valid, const glm::quat& rotation, // state.restoreTranslation(1.0f, priority); } } + } + if (index >= 0 && index < (int)_overrideFlags.size()) { + assert(_overrideFlags.size() == _overridePoses.size()); _overrideFlags[index] = true; _overridePoses[index].rot = rotation; + _overridePoses[index].trans = translation; } } diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 4523cbeff7..9c803e1d7f 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -318,7 +318,7 @@ bool Rig::getJointStateRotation(int index, glm::quat& rotation) const { if (index >= 0 && index < (int)_relativePoses.size()) { rotation = _relativePoses[index].rot; - return isEqual(rotation, _animSkeleton->getRelativeDefaultPose(index).rot); + return !isEqual(rotation, _animSkeleton->getRelativeDefaultPose(index).rot); } else { return false; } @@ -336,7 +336,7 @@ bool Rig::getJointStateTranslation(int index, glm::vec3& translation) const { if (index >= 0 && index < (int)_relativePoses.size()) { translation = _relativePoses[index].trans; - return isEqual(translation, _animSkeleton->getRelativeDefaultPose(index).trans); + return !isEqual(translation, _animSkeleton->getRelativeDefaultPose(index).trans); } else { return false; }