History

Merge pull request #16400 from hyperlogic/feature/arkit-blendshapes

Extended avatar blendshape support for ARKit compatiblity

Anthony Thibault committed 7 years ago

Commit f99bb3e2 parents a035344 9325ea546 files · +950 −1750Browse files

Showing the changes to interface/src/Application.cpp (1 of 46 files). Show all

Unified · Split

interface/src/Application.cpp+1−112
@@ -170,7 +170,6 @@ · 169 unmodified lines
170#include "avatar/MyCharacterController.h"170#include "avatar/MyCharacterController.h"
171#include "CrashRecoveryHandler.h"171#include "CrashRecoveryHandler.h"
172#include "CrashHandler.h"172#include "CrashHandler.h"
173#include "devices/DdeFaceTracker.h"
174#include "DiscoverabilityManager.h"173#include "DiscoverabilityManager.h"
175#include "GLCanvas.h"174#include "GLCanvas.h"
176#include "InterfaceDynamicFactory.h"175#include "InterfaceDynamicFactory.h"
@@ -888,11 +887,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 711 unmodified lines
888 DependencyManager::set<ScriptCache>();887 DependencyManager::set<ScriptCache>();
889 DependencyManager::set<SoundCache>();888 DependencyManager::set<SoundCache>();
890 DependencyManager::set<SoundCacheScriptingInterface>();889 DependencyManager::set<SoundCacheScriptingInterface>();
891
892#ifdef HAVE_DDE
893 DependencyManager::set<DdeFaceTracker>();
894#endif
895
896 DependencyManager::set<AudioClient>();890 DependencyManager::set<AudioClient>();
897 DependencyManager::set<AudioScope>();891 DependencyManager::set<AudioScope>();
898 DependencyManager::set<DeferredLightingEffect>();892 DependencyManager::set<DeferredLightingEffect>();
@@ -1069,7 +1063,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 170 unmodified lines
1069 _lastSendDownstreamAudioStats(usecTimestampNow()),1063 _lastSendDownstreamAudioStats(usecTimestampNow()),
1070 _notifiedPacketVersionMismatchThisDomain(false),1064 _notifiedPacketVersionMismatchThisDomain(false),
1071 _maxOctreePPS(maxOctreePacketsPerSecond.get()),1065 _maxOctreePPS(maxOctreePacketsPerSecond.get()),
1072 _lastFaceTrackerUpdate(0),
1073 _snapshotSound(nullptr),1066 _snapshotSound(nullptr),
1074 _sampleSound(nullptr)1067 _sampleSound(nullptr)
1075{1068{
@@ -2019,13 +2012,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 943 unmodified lines
2019 this->installEventFilter(this);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 // If launched from Steam, let it handle updates2015 // If launched from Steam, let it handle updates
2030 const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater";2016 const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater";
2031 bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1;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 // Stop third party processes so that they're not left running in the event of a subsequent shutdown crash.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 AnimDebugDraw::getInstance().shutdown();2756 AnimDebugDraw::getInstance().shutdown();
2774 2757
2775 // FIXME: once we move to shared pointer for the INputDevice we shoud remove this naked delete: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 _window->saveGeometry();2823 _window->saveGeometry();
2841 2824
2842 // Destroy third party processes after scripts have finished using them.2825 // Destroy third party processes after scripts have finished using them.
2843#ifdef HAVE_DDE
2844 DependencyManager::destroy<DdeFaceTracker>();
2845#endif
2846
2847 DependencyManager::destroy<ContextOverlayInterface>(); // Must be destroyed before TabletScriptingInterface2826 DependencyManager::destroy<ContextOverlayInterface>(); // Must be destroyed before TabletScriptingInterface
2848 2827
2849 // stop QML2828 // stop QML
@@ -3478,9 +3457,6 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 628 unmodified lines
3478 surfaceContext->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance());3457 surfaceContext->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance());
3479 3458
3480 surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);3459 surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
3481#ifdef HAVE_DDE
3482 surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
3483#endif
3484 surfaceContext->setContextProperty("AvatarManager", DependencyManager::get<AvatarManager>().data());3460 surfaceContext->setContextProperty("AvatarManager", DependencyManager::get<AvatarManager>().data());
3485 surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());3461 surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
3486 surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());3462 surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
@@ -3747,16 +3723,6 @@ void Application::runTests() { · 260 unmodified lines
3747 runUnitTests();3723 runUnitTests();
3748}3724}
3749 3725
3750void 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
3760void Application::setFieldOfView(float fov) {3726void Application::setFieldOfView(float fov) {
3761 if (fov != _fieldOfView.get()) {3727 if (fov != _fieldOfView.get()) {
3762 _fieldOfView.set(fov);3728 _fieldOfView.set(fov);
@@ -5331,43 +5297,6 @@ ivec2 Application::getMouse() const { · 1568 unmodified lines
5331 return getApplicationCompositor().getReticlePosition();5297 return getApplicationCompositor().getReticlePosition();
5332}5298}
5333 5299
5334FaceTracker* 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
5346FaceTracker* 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
5356void 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
5371bool Application::exportEntities(const QString& filename,5300bool Application::exportEntities(const QString& filename,
5372 const QVector<QUuid>& entityIDs,5301 const QVector<QUuid>& entityIDs,
5373 const glm::vec3* givenOffset) {5302 const glm::vec3* givenOffset) {
@@ -5851,8 +5780,7 @@ void Application::updateMyAvatarLookAtPosition(float deltaTime) { · 477 unmodified lines
5851 PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()");5780 PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()");
5852 5781
5853 auto myAvatar = getMyAvatar();5782 auto myAvatar = getMyAvatar();
5854 FaceTracker* faceTracker = getActiveFaceTracker();5783 myAvatar->updateEyesLookAtPosition(deltaTime);
5855 myAvatar->updateEyesLookAtPosition(faceTracker, _myCamera, deltaTime);
5856}5784}
5857 5785
5858void Application::updateThreads(float deltaTime) {5786void Application::updateThreads(float deltaTime) {
@@ -6278,37 +6206,6 @@ void Application::update(float deltaTime) { · 419 unmodified lines
6278 auto myAvatar = getMyAvatar();6206 auto myAvatar = getMyAvatar();
6279 {6207 {
6280 PerformanceTimer perfTimer("devices");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 auto userInputMapper = DependencyManager::get<UserInputMapper>();6209 auto userInputMapper = DependencyManager::get<UserInputMapper>();
6313 6210
6314 controller::HmdAvatarAlignmentType hmdAvatarAlignmentType;6211 controller::HmdAvatarAlignmentType hmdAvatarAlignmentType;
@@ -7104,10 +7001,6 @@ void Application::copyDisplayViewFrustum(ViewFrustum& viewOut) const { · 789 unmodified lines
7104// feature. However, we still use this to reset face trackers, eye trackers, audio and to optionally re-load the avatar7001// feature. However, we still use this to reset face trackers, eye trackers, audio and to optionally re-load the avatar
7105// rig and animations from scratch.7002// rig and animations from scratch.
7106void Application::resetSensors(bool andReload) {7003void Application::resetSensors(bool andReload) {
7107#ifdef HAVE_DDE
7108 DependencyManager::get<DdeFaceTracker>()->reset();
7109#endif
7110
7111 _overlayConductor.centerUI();7004 _overlayConductor.centerUI();
7112 getActiveDisplayPlugin()->resetSensors();7005 getActiveDisplayPlugin()->resetSensors();
7113 getMyAvatar()->reset(true, andReload);7006 getMyAvatar()->reset(true, andReload);
@@ -7509,10 +7402,6 @@ void Application::registerScriptEngineWithApplicationServices(const ScriptEngine · 395 unmodified lines
7509 scriptEngine->registerGlobalObject("AccountServices", AccountServicesScriptingInterface::getInstance());7402 scriptEngine->registerGlobalObject("AccountServices", AccountServicesScriptingInterface::getInstance());
7510 qScriptRegisterMetaType(scriptEngine.data(), DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue);7403 qScriptRegisterMetaType(scriptEngine.data(), DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue);
7511 7404
7512#ifdef HAVE_DDE
7513 scriptEngine->registerGlobalObject("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
7514#endif
7515
7516 scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data());7405 scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data());
7517 7406
7518 scriptEngine->registerGlobalObject("LODManager", DependencyManager::get<LODManager>().data());7407 scriptEngine->registerGlobalObject("LODManager", DependencyManager::get<LODManager>().data());

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t