From a2562c92f44d4d54b914c74f58538191b1734b17 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Sun, 27 Sep 2015 16:24:55 -0700 Subject: [PATCH] Small changes to Anim System for Debugging * Added constant for Rig animation fade time * Added index output for AnimSkeleton::dump() --- libraries/animation/src/AnimSkeleton.cpp | 2 ++ libraries/animation/src/Rig.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/animation/src/AnimSkeleton.cpp b/libraries/animation/src/AnimSkeleton.cpp index 6731756aeb..173e387608 100644 --- a/libraries/animation/src/AnimSkeleton.cpp +++ b/libraries/animation/src/AnimSkeleton.cpp @@ -173,6 +173,7 @@ void AnimSkeleton::dump() const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; + qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i); qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i); @@ -188,6 +189,7 @@ void AnimSkeleton::dump(const AnimPoseVec& poses) const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; + qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i); qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i); diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 1874939b3d..130398eb4a 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -145,16 +145,19 @@ AnimationHandlePointer Rig::addAnimationByRole(const QString& role, const QStrin } return handle; } + +const float FADE_FRAMES = 30.0f; + void Rig::startAnimationByRole(const QString& role, const QString& url, float fps, float priority, bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) { AnimationHandlePointer handle = addAnimationByRole(role, url, fps, priority, loop, hold, firstFrame, lastFrame, maskedJoints, true); - handle->setFadePerSecond(1.0f); // For now. Could be individualized later. + handle->setFadePerSecond(30.0f / FADE_FRAMES); // For now. Could be individualized later. } void Rig::stopAnimationByRole(const QString& role) { foreach (const AnimationHandlePointer& handle, getRunningAnimations()) { if (handle->getRole() == role) { - handle->setFadePerSecond(-1.0f); // For now. Could be individualized later. + handle->setFadePerSecond(-(30.0f / FADE_FRAMES)); // For now. Could be individualized later. } } } @@ -163,7 +166,7 @@ void Rig::stopAnimation(const QString& url) { foreach (const AnimationHandlePointer& handle, getRunningAnimations()) { if (handle->getURL() == url) { handle->setFade(0.0f); // right away. Will be remove during updateAnimations, without locking - handle->setFadePerSecond(-1.0f); // so that the updateAnimation code notices + handle->setFadePerSecond(-(30.0f / FADE_FRAMES)); // so that the updateAnimation code notices } } }