summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-09 12:45:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-09 12:54:55 +0100
commit5a5cf4bac9af84252b28e56b15b71708f8cd3b7b (patch)
tree19c4561fcf66ab32b2a629f74157f815c7b464d5
parentbad34742736f7d9ee781f77766629140a49d6f28 (diff)
gui, logic: allow toggle neck displacement
It was only possible to zero the values to turn it off.
-rw-r--r--gui/options-dialog.cpp2
-rw-r--r--gui/options-dialog.ui64
-rw-r--r--logic/main-settings.hpp2
-rw-r--r--logic/tracker.cpp7
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<void(bool)> 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 @@
<x>0</x>
<y>0</y>
<width>404</width>
- <height>597</height>
+ <height>596</height>
</rect>
</property>
<property name="windowTitle">
@@ -1520,20 +1520,30 @@
</item>
<item>
<widget class="QGroupBox" name="groupBox_12">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Neck displacement</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
+ <property name="spacing">
+ <number>7</number>
+ </property>
<item>
<widget class="QLabel" name="label_33">
<property name="text">
- <string>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.</string>
+ <string>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.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
+ <property name="margin">
+ <number>0</number>
+ </property>
</widget>
</item>
<item>
@@ -1546,7 +1556,7 @@ It also works with relative translation disabled.</string>
<number>0</number>
</property>
<property name="topMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
@@ -1557,7 +1567,7 @@ It also works with relative translation disabled.</string>
<property name="spacing">
<number>0</number>
</property>
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="label_31">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -1570,7 +1580,7 @@ It also works with relative translation disabled.</string>
</property>
</widget>
</item>
- <item row="0" column="1">
+ <item row="1" column="1">
<widget class="QSpinBox" name="neck_y">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -1589,7 +1599,26 @@ It also works with relative translation disabled.</string>
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="neck_z">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>4</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ <property name="maximum">
+ <number>50</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
<widget class="QLabel" name="label_32">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -1602,22 +1631,19 @@ It also works with relative translation disabled.</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="neck_z">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="neck_enable">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>4</horstretch>
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="suffix">
- <string> cm</string>
+ <property name="styleSheet">
+ <string notr="true"/>
</property>
- <property name="maximum">
- <number>50</number>
+ <property name="text">
+ <string>Enable</string>
</property>
</widget>
</item>
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<bool> center_at_startup;
value<int> center_method;
value<int> neck_y, neck_z;
+ value<bool> 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);