diff --git a/examples/theBird.js b/examples/theBird.js index c7fd5a38b7..02b2e7fc5d 100644 --- a/examples/theBird.js +++ b/examples/theBird.js @@ -20,7 +20,9 @@ for (i = 0; i < l; i++) { print(roles[i]); } -// replace point with the bird! +MyAvatar.prefetchAnimation(THE_BIRD_RIGHT_URL); + +// replace point animations with the bird! MyAvatar.overrideRoleAnimation("rightHandPointIntro", THE_BIRD_RIGHT_URL, 30, false, 0, 12); MyAvatar.overrideRoleAnimation("rightHandPointHold", THE_BIRD_RIGHT_URL, 30, false, 12, 12); MyAvatar.overrideRoleAnimation("rightHandPointOutro", THE_BIRD_RIGHT_URL, 30, false, 19, 30); diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index e1cc5ec7f5..94e98457fd 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -180,7 +180,10 @@ void Rig::restoreRoleAnimation(const QString& role) { void Rig::prefetchAnimation(const QString& url) { if (_enableAnimGraph) { - // TODO: + // This will begin loading the NetworkGeometry for the given URL. + // which should speed us up if we request it later via overrideAnimation. + auto clipNode = std::make_shared("prefetch", url, 0, 0, 1.0, false); + _prefetchedAnimations.push_back(clipNode); } } diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index cd5152152a..191029f2af 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -265,6 +265,7 @@ public: SimpleMovingAverage _averageLateralSpeed { 10 }; std::map _origRoleAnimations; + std::vector _prefetchedAnimations; private: QMap _stateHandlers;