mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
Add menu item that enables / disables simulated eye tracking
This commit is contained in:
parent
72a590e34c
commit
f0ed8d8cef
5 changed files with 23 additions and 21 deletions
|
@ -595,12 +595,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
loadScripts();
|
loadScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IVIEWHMD
|
|
||||||
// Do this before loading settings
|
|
||||||
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
|
||||||
eyeTracker->init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
|
int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
|
||||||
connect(&_settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
|
connect(&_settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
|
||||||
|
@ -642,6 +636,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
connect(ddeTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled);
|
connect(ddeTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_IVIEWHMD
|
||||||
|
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
||||||
|
eyeTracker->init();
|
||||||
|
setActiveEyeTracker();
|
||||||
|
#endif
|
||||||
|
|
||||||
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
|
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
|
||||||
connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
|
connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
|
||||||
applicationUpdater->checkForUpdate();
|
applicationUpdater->checkForUpdate();
|
||||||
|
@ -2020,7 +2020,8 @@ void Application::setActiveFaceTracker() {
|
||||||
void Application::setActiveEyeTracker() {
|
void Application::setActiveEyeTracker() {
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
auto eyeTracker = DependencyManager::get<EyeTracker>();
|
||||||
eyeTracker->setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::SMIEyeTracking));
|
eyeTracker->setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::SMIEyeTracking),
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::SimulateEyeTracking));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,9 +439,10 @@ Menu::Menu() {
|
||||||
|
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
MenuWrapper* eyeTrackingMenu = avatarDebugMenu->addMenu("Eye Tracking");
|
MenuWrapper* eyeTrackingMenu = avatarDebugMenu->addMenu("Eye Tracking");
|
||||||
QAction* smiEyeTracking = addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SMIEyeTracking, 0, false,
|
addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SMIEyeTracking, 0, false,
|
||||||
|
qApp, SLOT(setActiveEyeTracker()));
|
||||||
|
addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SimulateEyeTracking, 0, false,
|
||||||
qApp, SLOT(setActiveEyeTracker()));
|
qApp, SLOT(setActiveEyeTracker()));
|
||||||
smiEyeTracking->setVisible(true);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||||
|
|
|
@ -273,6 +273,7 @@ namespace MenuOption {
|
||||||
const QString SixenseEnabled = "Enable Hydra Support";
|
const QString SixenseEnabled = "Enable Hydra Support";
|
||||||
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
||||||
const QString ShiftHipsForIdleAnimations = "Shift hips for idle animations";
|
const QString ShiftHipsForIdleAnimations = "Shift hips for idle animations";
|
||||||
|
const QString SimulateEyeTracking = "Simulate";
|
||||||
const QString SMIEyeTracking = "SMI Eye Tracking";
|
const QString SMIEyeTracking = "SMI Eye Tracking";
|
||||||
const QString Stars = "Stars";
|
const QString Stars = "Stars";
|
||||||
const QString Stats = "Stats";
|
const QString Stats = "Stats";
|
||||||
|
|
|
@ -59,26 +59,25 @@ void EyeTracker::init() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EyeTracker::setEnabled(bool enabled) {
|
void EyeTracker::setEnabled(bool enabled, bool simulate) {
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
qCWarning(interfaceapp) << "Eye Tracker: Not initialized before setting enabled";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
qCDebug(interfaceapp) << "Eye Tracker: Set enabled =" << enabled;
|
qCDebug(interfaceapp) << "Eye Tracker: Set enabled =" << enabled << ", simulate =" << simulate;
|
||||||
|
bool success = true;
|
||||||
if (enabled && !_isStreaming) {
|
int result = 0;
|
||||||
// There is no smi_stopStreaming() method so start streaming a maximum of once per program run.
|
if (enabled) {
|
||||||
int result = smi_startStreaming(true);
|
// There is no smi_stopStreaming() method so keep streaming once started in case tracking is re-enabled after stopping.
|
||||||
|
result = smi_startStreaming(simulate);
|
||||||
if (result != SMI_RET_SUCCESS) {
|
if (result != SMI_RET_SUCCESS) {
|
||||||
qCWarning(interfaceapp) << "Eye Tracker: Error starting streaming:" << result;
|
qCWarning(interfaceapp) << "Eye Tracker: Error starting streaming:" << smiReturnValueToString(result);
|
||||||
} else {
|
success = false;
|
||||||
_isStreaming = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_isEnabled = enabled && _isStreaming;
|
_isEnabled = enabled && success;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void init();
|
void init();
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled, bool simulate);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue