Restore joints state on stopAnimation

This commit is contained in:
Atlante45 2015-01-26 19:12:18 -08:00
parent 2108cac38e
commit f84f6e9b66
2 changed files with 12 additions and 0 deletions

View file

@ -74,6 +74,7 @@ void AnimationHandle::setRunning(bool running) {
}
} else {
_model->_runningAnimations.removeOne(_self);
restoreJoints();
replaceMatchingPriorities(0.0f);
}
emit runningChanged(isRunning());
@ -173,3 +174,13 @@ void AnimationHandle::replaceMatchingPriorities(float newPriority) {
}
}
void AnimationHandle::restoreJoints() {
for (int i = 0; i < _jointMappings.size(); i++) {
int mapping = _jointMappings.at(i);
if (mapping != -1) {
JointState& state = _model->_jointStates[mapping];
state.restoreRotation(1.0f, state._animationPriority);
}
}
}

View file

@ -92,6 +92,7 @@ private:
void simulate(float deltaTime);
void applyFrame(float frameIndex);
void replaceMatchingPriorities(float newPriority);
void restoreJoints();
Model* _model;
WeakAnimationHandlePointer _self;