Fix animation not automatically starting at start-up

This commit is contained in:
David Rowe 2015-04-14 16:54:14 -07:00
parent fe482b35ff
commit 2c5201f116
2 changed files with 4 additions and 7 deletions

View file

@ -640,7 +640,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();
@ -710,13 +709,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();

View file

@ -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) {