From 5a5cf4bac9af84252b28e56b15b71708f8cd3b7b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Dec 2016 12:45:29 +0100 Subject: gui, logic: allow toggle neck displacement It was only possible to zero the values to turn it off. --- gui/options-dialog.cpp | 2 ++ gui/options-dialog.ui | 64 ++++++++++++++++++++++++++++++++++--------------- logic/main-settings.hpp | 2 ++ logic/tracker.cpp | 7 +++--- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index 8190b0f7..51cfbcc7 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -92,6 +92,8 @@ OptionsDialog::OptionsDialog(std::function pause_keybindings) : tie_setting(main.tracklogging_enabled, ui.tracklogging_enabled); + tie_setting(main.neck_enable, ui.neck_enable); + ui.disable_translation->setChecked(QSettings(OPENTRACK_ORG).value("disable-translation", false).toBool()); struct tmp diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui index 250e2b9e..df7c80ff 100644 --- a/gui/options-dialog.ui +++ b/gui/options-dialog.ui @@ -7,7 +7,7 @@ 0 0 404 - 597 + 596 @@ -1520,20 +1520,30 @@ + + + 0 + 0 + + Neck displacement + + 7 + - Eyes will be offset from the pivot of rotation, assumed to be the neck. Set to zeros in order to disable. - -It also works with relative translation disabled. + Eyes will be offset from the pivot of rotation, assumed to be the neck. Set to zeros in order to disable. It also works with relative translation disabled. true + + 0 + @@ -1546,7 +1556,7 @@ It also works with relative translation disabled. 0 - 0 + 9 0 @@ -1557,7 +1567,7 @@ It also works with relative translation disabled. 0 - + @@ -1570,7 +1580,7 @@ It also works with relative translation disabled. - + @@ -1589,7 +1599,26 @@ It also works with relative translation disabled. - + + + + + 4 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + cm + + + 50 + + + + @@ -1602,22 +1631,19 @@ It also works with relative translation disabled. - - + + - - 4 + + 0 0 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - cm + + - - 50 + + Enable diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp index ea1d93f3..749f6d25 100644 --- a/logic/main-settings.hpp +++ b/logic/main-settings.hpp @@ -75,6 +75,7 @@ struct main_settings value center_at_startup; value center_method; value neck_y, neck_z; + value neck_enable; key_opts key_start_tracking, key_stop_tracking, key_toggle_tracking, key_restart_tracking; key_opts key_center, key_toggle, key_zero; key_opts key_toggle_press, key_zero_press; @@ -107,6 +108,7 @@ struct main_settings center_method(b, "centering-method", true), neck_y(b, "neck-height", 0), neck_z(b, "neck-depth", 0), + neck_enable(b, "neck-enable", false), key_start_tracking(b, "start-tracking"), key_stop_tracking(b, "stop-tracking"), key_toggle_tracking(b, "toggle-tracking"), diff --git a/logic/tracker.cpp b/logic/tracker.cpp index 25e067a7..332828a9 100644 --- a/logic/tracker.cpp +++ b/logic/tracker.cpp @@ -281,15 +281,16 @@ void Tracker::logic() euler_t neck, rel; + if (s.neck_enable) { double ny = s.neck_y, nz = -s.neck_z; if (ny != 0 || nz != 0) { const rmat R = euler_to_rmat( - euler_t(value(Yaw) * d2r, - value(Pitch) * d2r, - value(Roll) * d2r)); + euler_t(value(Yaw) * d2r, + value(Pitch) * d2r, + value(Roll) * d2r)); euler_t xyz(0, ny, nz); t_compensate(R, xyz, xyz, false, false, false); neck(TX) = xyz(TX); -- cgit v1.2.3