diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index b4905c9b9b..86aecfb47a 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -646,7 +646,6 @@ void MyAvatar::saveData() { settings.setValue("firstFrame", pointer->getFirstFrame()); settings.setValue("lastFrame", pointer->getLastFrame()); settings.setValue("maskedJoints", pointer->getMaskedJoints()); - settings.setValue("running", pointer->getLoop() && pointer->isRunning()); } settings.endArray(); @@ -761,13 +760,10 @@ void MyAvatar::loadData() { handle->setPriority(loadSetting(settings, "priority", 1.0f)); handle->setLoop(settings.value("loop", true).toBool()); handle->setHold(settings.value("hold", false).toBool()); - handle->setStartAutomatically(settings.value("startAutomatically", true).toBool()); handle->setFirstFrame(settings.value("firstFrame", 0.0f).toFloat()); handle->setLastFrame(settings.value("lastFrame", INT_MAX).toFloat()); handle->setMaskedJoints(settings.value("maskedJoints").toStringList()); - if (settings.value("loop", true).toBool() && settings.value("running", false).toBool()) { - handle->setRunning(true); - } + handle->setStartAutomatically(settings.value("startAutomatically", true).toBool()); } settings.endArray(); diff --git a/libraries/render-utils/src/AnimationHandle.cpp b/libraries/render-utils/src/AnimationHandle.cpp index 1cb3d4654f..55995b87d8 100644 --- a/libraries/render-utils/src/AnimationHandle.cpp +++ b/libraries/render-utils/src/AnimationHandle.cpp @@ -47,10 +47,11 @@ void AnimationHandle::setPriority(float priority) { } void AnimationHandle::setStartAutomatically(bool startAutomatically) { - _animationLoop.setStartAutomatically(startAutomatically); - if (getStartAutomatically() && !isRunning()) { + if (startAutomatically && !isRunning()) { + // Start before setting _animationLoop value so that code in setRunning() is executed start(); } + _animationLoop.setStartAutomatically(startAutomatically); } void AnimationHandle::setMaskedJoints(const QStringList& maskedJoints) { @@ -59,13 +60,10 @@ void AnimationHandle::setMaskedJoints(const QStringList& maskedJoints) { } void AnimationHandle::setRunning(bool running) { - if (isRunning() == running) { + if (running && isRunning()) { // if we're already running, this is the same as a restart - if (running) { - // move back to the beginning - setFrameIndex(getFirstFrame()); - return; - } + setFrameIndex(getFirstFrame()); + return; } _animationLoop.setRunning(running); if (isRunning()) {