From 1dd40af16242e4343dba5a728e5d7a3b7917415e Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 10 Jul 2015 12:43:35 -0700 Subject: [PATCH] fix AnimationLoop::setRunning() to not constantly reset the frame when the running state doesn't actually change --- libraries/animation/src/AnimationLoop.cpp | 10 +++++----- libraries/entities/src/EntityItemProperties.cpp | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/animation/src/AnimationLoop.cpp b/libraries/animation/src/AnimationLoop.cpp index e60df1eaf9..43e049f851 100644 --- a/libraries/animation/src/AnimationLoop.cpp +++ b/libraries/animation/src/AnimationLoop.cpp @@ -84,14 +84,14 @@ void AnimationLoop::setStartAutomatically(bool startAutomatically) { } void AnimationLoop::setRunning(bool running) { - if (_running == running) { + // don't do anything if the new value is the same as the value we already have + if (_running != running) { + _running = running; + + // If we just set running to true, then also reset the frame to the first frame if (running) { // move back to the beginning _frameIndex = _firstFrame; } - return; - } - if ((_running = running)) { - _frameIndex = _firstFrame; } } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 9a1a5494b7..106e0a6b8b 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -128,6 +128,10 @@ void EntityItemProperties::setSittingPoints(const QVector& sitting } } +bool EntityItemProperties::animationSettingsChanged() const { + return _animationSettingsChanged; +} + void EntityItemProperties::setAnimationSettings(const QString& value) { // the animations setting is a JSON string that may contain various animation settings. // if it includes fps, frameIndex, or running, those values will be parsed out and