mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-28 22:18:47 +02:00
Merge pull request #5490 from howard-stearns/restart-animations-at-specified-parameters
restart animations at specified parameters
This commit is contained in:
commit
f506e58687
1 changed files with 8 additions and 5 deletions
|
@ -58,15 +58,18 @@ void Rig::removeAnimationHandle(const AnimationHandlePointer& handle) {
|
||||||
|
|
||||||
void Rig::startAnimation(const QString& url, float fps, float priority,
|
void Rig::startAnimation(const QString& url, float fps, float priority,
|
||||||
bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) {
|
bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) {
|
||||||
//qCDebug(animation) << "startAnimation" << url << fps << priority << loop << hold << firstFrame << lastFrame << maskedJoints;
|
// This is different than startAnimationByRole, in which we use the existing values if the animation already exists.
|
||||||
|
// Here we reuse the animation handle if possible, but in any case, we set the values to those given (or defaulted).
|
||||||
|
AnimationHandlePointer handle = nullptr;
|
||||||
foreach (const AnimationHandlePointer& candidate, _animationHandles) {
|
foreach (const AnimationHandlePointer& candidate, _animationHandles) {
|
||||||
if (candidate->getURL() == url) {
|
if (candidate->getURL() == url) {
|
||||||
candidate->start();
|
handle = candidate;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AnimationHandlePointer handle = createAnimationHandle();
|
if (!handle) {
|
||||||
handle->setURL(url);
|
handle = createAnimationHandle();
|
||||||
|
handle->setURL(url);
|
||||||
|
}
|
||||||
handle->setFPS(fps);
|
handle->setFPS(fps);
|
||||||
handle->setPriority(priority);
|
handle->setPriority(priority);
|
||||||
handle->setLoop(loop);
|
handle->setLoop(loop);
|
||||||
|
|
Loading…
Reference in a new issue