Extended avatar blendshape support for ARKit compatiblity
Showing the changes to interface/src/Application.cpp (1 of 46 files). Show all
Unified · Split
| @@ -170,7 +170,6 @@ · 169 unmodified lines | ||
| 170 | 170 | #include "avatar/MyCharacterController.h" |
| 171 | 171 | #include "CrashRecoveryHandler.h" |
| 172 | 172 | #include "CrashHandler.h" |
| 173 | −#include "devices/DdeFaceTracker.h" | |
| 174 | 173 | #include "DiscoverabilityManager.h" |
| 175 | 174 | #include "GLCanvas.h" |
| 176 | 175 | #include "InterfaceDynamicFactory.h" |
| @@ -888,11 +887,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 711 unmodified lines | ||
| 888 | 887 | DependencyManager::set<ScriptCache>(); |
| 889 | 888 | DependencyManager::set<SoundCache>(); |
| 890 | 889 | DependencyManager::set<SoundCacheScriptingInterface>(); |
| 891 | − | |
| 892 | −#ifdef HAVE_DDE | |
| 893 | − DependencyManager::set<DdeFaceTracker>(); | |
| 894 | −#endif | |
| 895 | − | |
| 896 | 890 | DependencyManager::set<AudioClient>(); |
| 897 | 891 | DependencyManager::set<AudioScope>(); |
| 898 | 892 | DependencyManager::set<DeferredLightingEffect>(); |
| @@ -1069,7 +1063,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 170 unmodified lines | ||
| 1069 | 1063 | _lastSendDownstreamAudioStats(usecTimestampNow()), |
| 1070 | 1064 | _notifiedPacketVersionMismatchThisDomain(false), |
| 1071 | 1065 | _maxOctreePPS(maxOctreePacketsPerSecond.get()), |
| 1072 | − _lastFaceTrackerUpdate(0), | |
| 1073 | 1066 | _snapshotSound(nullptr), |
| 1074 | 1067 | _sampleSound(nullptr) |
| 1075 | 1068 | { |
| @@ -2019,13 +2012,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 943 unmodified lines | ||
| 2019 | 2012 | this->installEventFilter(this); |
| 2020 | 2013 | |
| 2021 | 2014 | |
| 2022 | − | |
| 2023 | −#ifdef HAVE_DDE | |
| 2024 | − auto ddeTracker = DependencyManager::get<DdeFaceTracker>(); | |
| 2025 | − ddeTracker->init(); | |
| 2026 | − connect(ddeTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled); | |
| 2027 | −#endif | |
| 2028 | − | |
| 2029 | 2015 | // If launched from Steam, let it handle updates |
| 2030 | 2016 | const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater"; |
| 2031 | 2017 | bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1; |
| @@ -2767,9 +2753,6 @@ void Application::cleanupBeforeQuit() { · 735 unmodified lines | ||
| 2767 | 2753 | } |
| 2768 | 2754 | |
| 2769 | 2755 | // Stop third party processes so that they're not left running in the event of a subsequent shutdown crash. |
| 2770 | −#ifdef HAVE_DDE | |
| 2771 | − DependencyManager::get<DdeFaceTracker>()->setEnabled(false); | |
| 2772 | −#endif | |
| 2773 | 2756 | AnimDebugDraw::getInstance().shutdown(); |
| 2774 | 2757 | |
| 2775 | 2758 | // FIXME: once we move to shared pointer for the INputDevice we shoud remove this naked delete: |
| @@ -2840,10 +2823,6 @@ void Application::cleanupBeforeQuit() { · 64 unmodified lines | ||
| 2840 | 2823 | _window->saveGeometry(); |
| 2841 | 2824 | |
| 2842 | 2825 | // Destroy third party processes after scripts have finished using them. |
| 2843 | −#ifdef HAVE_DDE | |
| 2844 | − DependencyManager::destroy<DdeFaceTracker>(); | |
| 2845 | −#endif | |
| 2846 | − | |
| 2847 | 2826 | DependencyManager::destroy<ContextOverlayInterface>(); // Must be destroyed before TabletScriptingInterface |
| 2848 | 2827 | |
| 2849 | 2828 | // stop QML |
| @@ -3478,9 +3457,6 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 628 unmodified lines | ||
| 3478 | 3457 | surfaceContext->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance()); |
| 3479 | 3458 | |
| 3480 | 3459 | surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface); |
| 3481 | −#ifdef HAVE_DDE | |
| 3482 | − surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data()); | |
| 3483 | −#endif | |
| 3484 | 3460 | surfaceContext->setContextProperty("AvatarManager", DependencyManager::get<AvatarManager>().data()); |
| 3485 | 3461 | surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data()); |
| 3486 | 3462 | surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data()); |
| @@ -3747,16 +3723,6 @@ void Application::runTests() { · 260 unmodified lines | ||
| 3747 | 3723 | runUnitTests(); |
| 3748 | 3724 | } |
| 3749 | 3725 | |
| 3750 | −void Application::faceTrackerMuteToggled() { | |
| 3751 | − | |
| 3752 | − QAction* muteAction = Menu::getInstance()->getActionForOption(MenuOption::MuteFaceTracking); | |
| 3753 | − Q_CHECK_PTR(muteAction); | |
| 3754 | − bool isMuted = getSelectedFaceTracker()->isMuted(); | |
| 3755 | − muteAction->setChecked(isMuted); | |
| 3756 | − getSelectedFaceTracker()->setEnabled(!isMuted); | |
| 3757 | − Menu::getInstance()->getActionForOption(MenuOption::CalibrateCamera)->setEnabled(!isMuted); | |
| 3758 | −} | |
| 3759 | − | |
| 3760 | 3726 | void Application::setFieldOfView(float fov) { |
| 3761 | 3727 | if (fov != _fieldOfView.get()) { |
| 3762 | 3728 | _fieldOfView.set(fov); |
| @@ -5331,43 +5297,6 @@ ivec2 Application::getMouse() const { · 1568 unmodified lines | ||
| 5331 | 5297 | return getApplicationCompositor().getReticlePosition(); |
| 5332 | 5298 | } |
| 5333 | 5299 | |
| 5334 | −FaceTracker* Application::getActiveFaceTracker() { | |
| 5335 | −#ifdef HAVE_DDE | |
| 5336 | − auto dde = DependencyManager::get<DdeFaceTracker>(); | |
| 5337 | − | |
| 5338 | − if (dde && dde->isActive()) { | |
| 5339 | − return static_cast<FaceTracker*>(dde.data()); | |
| 5340 | − } | |
| 5341 | −#endif | |
| 5342 | − | |
| 5343 | − return nullptr; | |
| 5344 | −} | |
| 5345 | − | |
| 5346 | −FaceTracker* Application::getSelectedFaceTracker() { | |
| 5347 | − FaceTracker* faceTracker = nullptr; | |
| 5348 | −#ifdef HAVE_DDE | |
| 5349 | − if (Menu::getInstance()->isOptionChecked(MenuOption::UseCamera)) { | |
| 5350 | − faceTracker = DependencyManager::get<DdeFaceTracker>().data(); | |
| 5351 | − } | |
| 5352 | −#endif | |
| 5353 | − return faceTracker; | |
| 5354 | −} | |
| 5355 | − | |
| 5356 | −void Application::setActiveFaceTracker() const { | |
| 5357 | −#ifdef HAVE_DDE | |
| 5358 | − bool isMuted = Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking); | |
| 5359 | − bool isUsingDDE = Menu::getInstance()->isOptionChecked(MenuOption::UseCamera); | |
| 5360 | − Menu::getInstance()->getActionForOption(MenuOption::BinaryEyelidControl)->setVisible(isUsingDDE); | |
| 5361 | − Menu::getInstance()->getActionForOption(MenuOption::CoupleEyelids)->setVisible(isUsingDDE); | |
| 5362 | − Menu::getInstance()->getActionForOption(MenuOption::UseAudioForMouth)->setVisible(isUsingDDE); | |
| 5363 | − Menu::getInstance()->getActionForOption(MenuOption::VelocityFilter)->setVisible(isUsingDDE); | |
| 5364 | − Menu::getInstance()->getActionForOption(MenuOption::CalibrateCamera)->setVisible(isUsingDDE); | |
| 5365 | − auto ddeTracker = DependencyManager::get<DdeFaceTracker>(); | |
| 5366 | − ddeTracker->setIsMuted(isMuted); | |
| 5367 | − ddeTracker->setEnabled(isUsingDDE && !isMuted); | |
| 5368 | −#endif | |
| 5369 | −} | |
| 5370 | − | |
| 5371 | 5300 | bool Application::exportEntities(const QString& filename, |
| 5372 | 5301 | const QVector<QUuid>& entityIDs, |
| 5373 | 5302 | const glm::vec3* givenOffset) { |
| @@ -5851,8 +5780,7 @@ void Application::updateMyAvatarLookAtPosition(float deltaTime) { · 477 unmodified lines | ||
| 5851 | 5780 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); |
| 5852 | 5781 | |
| 5853 | 5782 | auto myAvatar = getMyAvatar(); |
| 5854 | − FaceTracker* faceTracker = getActiveFaceTracker(); | |
| 5855 | − myAvatar->updateEyesLookAtPosition(faceTracker, _myCamera, deltaTime); | |
| 5783 | + myAvatar->updateEyesLookAtPosition(deltaTime); | |
| 5856 | 5784 | } |
| 5857 | 5785 | |
| 5858 | 5786 | void Application::updateThreads(float deltaTime) { |
| @@ -6278,37 +6206,6 @@ void Application::update(float deltaTime) { · 419 unmodified lines | ||
| 6278 | 6206 | auto myAvatar = getMyAvatar(); |
| 6279 | 6207 | { |
| 6280 | 6208 | PerformanceTimer perfTimer("devices"); |
| 6281 | − | |
| 6282 | − FaceTracker* tracker = getSelectedFaceTracker(); | |
| 6283 | − if (tracker && Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking) != tracker->isMuted()) { | |
| 6284 | − tracker->toggleMute(); | |
| 6285 | − } | |
| 6286 | − | |
| 6287 | − tracker = getActiveFaceTracker(); | |
| 6288 | − if (tracker && !tracker->isMuted()) { | |
| 6289 | − tracker->update(deltaTime); | |
| 6290 | − | |
| 6291 | − // Auto-mute microphone after losing face tracking? | |
| 6292 | − if (tracker->isTracking()) { | |
| 6293 | − _lastFaceTrackerUpdate = usecTimestampNow(); | |
| 6294 | − } else { | |
| 6295 | − const quint64 MUTE_MICROPHONE_AFTER_USECS = 5000000; //5 secs | |
| 6296 | − Menu* menu = Menu::getInstance(); | |
| 6297 | − auto audioClient = DependencyManager::get<AudioClient>(); | |
| 6298 | − if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !audioClient->isMuted()) { | |
| 6299 | − if (_lastFaceTrackerUpdate > 0 | |
| 6300 | − && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) { | |
| 6301 | − audioClient->setMuted(true); | |
| 6302 | − _lastFaceTrackerUpdate = 0; | |
| 6303 | − } | |
| 6304 | − } else { | |
| 6305 | − _lastFaceTrackerUpdate = 0; | |
| 6306 | − } | |
| 6307 | − } | |
| 6308 | − } else { | |
| 6309 | − _lastFaceTrackerUpdate = 0; | |
| 6310 | − } | |
| 6311 | − | |
| 6312 | 6209 | auto userInputMapper = DependencyManager::get<UserInputMapper>(); |
| 6313 | 6210 | |
| 6314 | 6211 | controller::HmdAvatarAlignmentType hmdAvatarAlignmentType; |
| @@ -7104,10 +7001,6 @@ void Application::copyDisplayViewFrustum(ViewFrustum& viewOut) const { · 789 unmodified lines | ||
| 7104 | 7001 | // feature. However, we still use this to reset face trackers, eye trackers, audio and to optionally re-load the avatar |
| 7105 | 7002 | // rig and animations from scratch. |
| 7106 | 7003 | void Application::resetSensors(bool andReload) { |
| 7107 | −#ifdef HAVE_DDE | |
| 7108 | − DependencyManager::get<DdeFaceTracker>()->reset(); | |
| 7109 | −#endif | |
| 7110 | − | |
| 7111 | 7004 | _overlayConductor.centerUI(); |
| 7112 | 7005 | getActiveDisplayPlugin()->resetSensors(); |
| 7113 | 7006 | getMyAvatar()->reset(true, andReload); |
| @@ -7509,10 +7402,6 @@ void Application::registerScriptEngineWithApplicationServices(const ScriptEngine · 395 unmodified lines | ||
| 7509 | 7402 | scriptEngine->registerGlobalObject("AccountServices", AccountServicesScriptingInterface::getInstance()); |
| 7510 | 7403 | qScriptRegisterMetaType(scriptEngine.data(), DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue); |
| 7511 | 7404 | |
| 7512 | −#ifdef HAVE_DDE | |
| 7513 | − scriptEngine->registerGlobalObject("FaceTracker", DependencyManager::get<DdeFaceTracker>().data()); | |
| 7514 | −#endif | |
| 7515 | − | |
| 7516 | 7405 | scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data()); |
| 7517 | 7406 | |
| 7518 | 7407 | scriptEngine->registerGlobalObject("LODManager", DependencyManager::get<LODManager>().data()); |