summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--FaceTrackNoIR.suobin268288 -> 268288 bytes
-rw-r--r--FaceTrackNoIR/FTNoIR_FSUIPCcontrols.ui11
-rw-r--r--FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui214
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp47
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui4
-rw-r--r--FaceTrackNoIR/tracker.cpp55
-rw-r--r--FaceTrackNoIR/tracker.h12
-rw-r--r--bin/FaceTrackNoIR.exebin667648 -> 684032 bytes
8 files changed, 316 insertions, 27 deletions
diff --git a/FaceTrackNoIR.suo b/FaceTrackNoIR.suo
index b3bb6fca..bb4a4a07 100644
--- a/FaceTrackNoIR.suo
+++ b/FaceTrackNoIR.suo
Binary files differ
diff --git a/FaceTrackNoIR/FTNoIR_FSUIPCcontrols.ui b/FaceTrackNoIR/FTNoIR_FSUIPCcontrols.ui
index 7dc627b0..b6120378 100644
--- a/FaceTrackNoIR/FTNoIR_FSUIPCcontrols.ui
+++ b/FaceTrackNoIR/FTNoIR_FSUIPCcontrols.ui
@@ -116,6 +116,17 @@
</spacer>
</item>
<item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>The DLL should be placed in the Modules folder of MS Flight Simulator</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_2">
diff --git a/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui b/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui
index f495d38a..02f2028f 100644
--- a/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui
+++ b/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>346</width>
- <height>180</height>
+ <width>638</width>
+ <height>165</height>
</rect>
</property>
<property name="windowTitle">
@@ -25,8 +25,8 @@
</property>
<layout class="QVBoxLayout" name="_vertical_layout">
<item>
- <layout class="QHBoxLayout" name="horLayCenter">
- <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
<widget class="QLabel" name="textLabel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -42,28 +42,46 @@
</property>
</widget>
</item>
- <item>
+ <item row="0" column="1">
<widget class="QCheckBox" name="chkCenterShift">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>Shift</string>
</property>
</widget>
</item>
- <item>
+ <item row="0" column="2">
<widget class="QCheckBox" name="chkCenterCtrl">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>Ctrl</string>
</property>
</widget>
</item>
- <item>
+ <item row="0" column="3">
<widget class="QCheckBox" name="chkCenterAlt">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>Alt</string>
</property>
</widget>
</item>
- <item>
+ <item row="0" column="4">
<widget class="QComboBox" name="cbxCenterKey">
<property name="minimumSize">
<size>
@@ -79,39 +97,53 @@
</property>
</widget>
</item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
+ <item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Start/stop</string>
</property>
</widget>
</item>
- <item>
+ <item row="1" column="1">
<widget class="QCheckBox" name="chkStartStopShift">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>Shift</string>
</property>
</widget>
</item>
- <item>
+ <item row="1" column="2">
<widget class="QCheckBox" name="chkStartStopCtrl">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>Ctrl</string>
</property>
</widget>
</item>
- <item>
+ <item row="1" column="3">
<widget class="QCheckBox" name="chkStartStopAlt">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>Alt</string>
</property>
</widget>
</item>
- <item>
+ <item row="1" column="4">
<widget class="QComboBox" name="cbxStartStopKey">
<property name="minimumSize">
<size>
@@ -121,6 +153,147 @@
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Axis Inhibitor</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkInhibitShift">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Shift</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="chkInhibitCtrl">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Ctrl</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QCheckBox" name="chkInhibitAlt">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Alt</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4">
+ <widget class="QComboBox" name="cbxInhibitKey">
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="6">
+ <widget class="QCheckBox" name="chkInhibitPitch">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="7">
+ <widget class="QCheckBox" name="chkInhibitYaw">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="8">
+ <widget class="QCheckBox" name="chkInhibitRoll">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Roll</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="9">
+ <widget class="QCheckBox" name="chkInhibitX">
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>X</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="10">
+ <widget class="QCheckBox" name="chkInhibitY">
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="11">
+ <widget class="QCheckBox" name="chkInhibitZ">
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Z</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="5">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Disables:</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
@@ -138,6 +311,13 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>The axis inhibitor shortkey toggles the selected axis Off/On</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 3f3d3018..8f26d08a 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -805,6 +805,7 @@ void FaceTrackNoIR::setIcon(int index)
trayIcon->showMessage( "FaceTrackNoIR", ui.iconcomboBox->itemText(index));
}
setWindowIcon(QIcon(QCoreApplication::applicationDirPath() + "/images/FaceTrackNoIR.ico"));
+ ui.btnShowServerControls->setIcon(icon);
settingsDirty = true;
@@ -999,6 +1000,19 @@ QWidget( parent , f)
connect(ui.chkStartStopCtrl, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
connect(ui.chkStartStopAlt, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.cbxInhibitKey, SIGNAL(currentIndexChanged(int)), this, SLOT(keyChanged( int )));
+ connect(ui.chkInhibitShift, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitCtrl, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitAlt, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+
+ // Also add events for the Axis-checkboxes
+ connect(ui.chkInhibitShift, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitYaw, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitRoll, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitX, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitY, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.chkInhibitZ, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+
//
// Clear the Lists with key-descriptions and keycodes and build the Lists
// The strings will all be added to the ListBoxes for each Shortkey
@@ -1137,6 +1151,7 @@ QWidget( parent , f)
for ( int i = 0; i < stringList.size(); i++) {
ui.cbxCenterKey->addItem(stringList.at(i));
ui.cbxStartStopKey->addItem(stringList.at(i));
+ ui.cbxInhibitKey->addItem(stringList.at(i));
}
// Load the settings from the current .INI-file
@@ -1236,6 +1251,25 @@ int keyindex;
ui.chkStartStopCtrl->setChecked (iniFile.value ( "Ctrl_StartStop", 0 ).toBool());
ui.chkStartStopAlt->setChecked (iniFile.value ( "Alt_StartStop", 0 ).toBool());
+ // Axis-inhibitor key
+ keyindex = keyList.indexOf ( iniFile.value ( "Keycode_Inhibit", 1 ).toInt() );
+ if ( keyindex > 0 ) {
+ ui.cbxInhibitKey->setCurrentIndex( keyindex );
+ }
+ else {
+ ui.cbxInhibitKey->setCurrentIndex( 0 );
+ }
+ ui.chkInhibitShift->setChecked (iniFile.value ( "Shift_Inhibit", 0 ).toBool());
+ ui.chkInhibitCtrl->setChecked (iniFile.value ( "Ctrl_Inhibit", 0 ).toBool());
+ ui.chkInhibitAlt->setChecked (iniFile.value ( "Alt_Inhibit", 0 ).toBool());
+
+ ui.chkInhibitPitch->setChecked (iniFile.value ( "Inhibit_Pitch", 0 ).toBool());
+ ui.chkInhibitYaw->setChecked (iniFile.value ( "Inhibit_Yaw", 0 ).toBool());
+ ui.chkInhibitRoll->setChecked (iniFile.value ( "Inhibit_Roll", 0 ).toBool());
+ ui.chkInhibitX->setChecked (iniFile.value ( "Inhibit_X", 0 ).toBool());
+ ui.chkInhibitY->setChecked (iniFile.value ( "Inhibit_Y", 0 ).toBool());
+ ui.chkInhibitZ->setChecked (iniFile.value ( "Inhibit_Z", 0 ).toBool());
+
iniFile.endGroup ();
settingsDirty = false;
@@ -1264,6 +1298,19 @@ void KeyboardShortcutDialog::save() {
iniFile.setValue ( "Shift_StartStop", ui.chkStartStopShift->isChecked() );
iniFile.setValue ( "Ctrl_StartStop", ui.chkStartStopCtrl->isChecked() );
iniFile.setValue ( "Alt_StartStop", ui.chkStartStopAlt->isChecked() );
+
+ iniFile.setValue ( "Keycode_Inhibit", keyList.at( ui.cbxInhibitKey->currentIndex() ) );
+ iniFile.setValue ( "Shift_Inhibit", ui.chkInhibitShift->isChecked() );
+ iniFile.setValue ( "Ctrl_Inhibit", ui.chkInhibitCtrl->isChecked() );
+ iniFile.setValue ( "Alt_Inhibit", ui.chkInhibitAlt->isChecked() );
+
+ iniFile.setValue ( "Inhibit_Pitch", ui.chkInhibitPitch->isChecked() );
+ iniFile.setValue ( "Inhibit_Yaw", ui.chkInhibitYaw->isChecked() );
+ iniFile.setValue ( "Inhibit_Roll", ui.chkInhibitRoll->isChecked() );
+ iniFile.setValue ( "Inhibit_X", ui.chkInhibitX->isChecked() );
+ iniFile.setValue ( "Inhibit_Y", ui.chkInhibitY->isChecked() );
+ iniFile.setValue ( "Inhibit_Z", ui.chkInhibitZ->isChecked() );
+
iniFile.endGroup ();
settingsDirty = false;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index 3ef87463..74201bb0 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -892,7 +892,7 @@ color:#000;</string>
<widget class="QGroupBox" name="groupGameProtocol">
<property name="minimumSize">
<size>
- <width>200</width>
+ <width>190</width>
<height>100</height>
</size>
</property>
@@ -929,7 +929,7 @@ color:#000;</string>
<rect>
<x>10</x>
<y>80</y>
- <width>161</width>
+ <width>151</width>
<height>23</height>
</rect>
</property>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 4c6d619b..91cdaea2 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -23,6 +23,7 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20101024 - WVR: Added shortkey to disable/enable one or more axis during tracking.
20101021 - WVR: Added FSUIPC server for FS2004.
20101011 - WVR: Added SimConnect server.
20101007 - WVR: Created 6DOF-curves and drastically changed the tracker for that.
@@ -50,6 +51,7 @@ bool Tracker::confid = false;
bool Tracker::set_initial = false;
bool Tracker::do_tracking = true;
bool Tracker::do_center = false;
+bool Tracker::do_inhibit = false;
bool Tracker::useFilter = false;
long Tracker::prevHeadPoseTime = 0;
@@ -62,6 +64,7 @@ THeadPoseDOF Tracker::Z;
TShortKey Tracker::CenterKey; // ShortKey to Center headposition
TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking
+TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking
/** constructor **/
Tracker::Tracker( int clientID ) {
@@ -275,8 +278,9 @@ void Tracker::run() {
LPDIRECTINPUTDEVICE8 dinkeyboard; // the pointer to the keyboard device
BYTE keystate[256]; // the storage for the key-information
HRESULT retAcquire;
- bool lastBackKey = false; // Remember state, to detect rising edge
- bool lastEqualsKey = false;
+ bool lastCenterKey = false; // Remember state, to detect rising edge
+ bool lastStartStopKey = false;
+ bool lastInhibitKey = false;
float rawrotX, rawrotY, rawrotZ; // Locals...
float rawposX, rawposY, rawposZ;
@@ -342,7 +346,7 @@ void Tracker::run() {
//
// Check the state of the Start/Stop key
//
- if ( isShortKeyPressed( &StartStopKey, &keystate[0] ) && (!lastBackKey) ) {
+ if ( isShortKeyPressed( &StartStopKey, &keystate[0] ) && (!lastStartStopKey) ) {
Tracker::do_tracking = !Tracker::do_tracking;
//
@@ -374,16 +378,32 @@ void Tracker::run() {
}
qDebug() << "Tracker::run() says StartStop pressed, do_tracking =" << Tracker::do_tracking;
}
- lastBackKey = isShortKeyPressed( &StartStopKey, &keystate[0] ); // Remember
+ lastStartStopKey = isShortKeyPressed( &StartStopKey, &keystate[0] ); // Remember
//
// Check the state of the Center key
//
- if ( isShortKeyPressed( &CenterKey, &keystate[0] ) && (!lastEqualsKey) ) {
+ if ( isShortKeyPressed( &CenterKey, &keystate[0] ) && (!lastCenterKey) ) {
Tracker::do_center = true;
qDebug() << "Tracker::run() says Center pressed";
}
- lastEqualsKey = isShortKeyPressed( &CenterKey, &keystate[0] ); // Remember
+ lastCenterKey = isShortKeyPressed( &CenterKey, &keystate[0] ); // Remember
+
+ //
+ // Check the state of the Inhibit key
+ //
+ if ( isShortKeyPressed( &InhibitKey, &keystate[0] ) && (!lastInhibitKey) ) {
+ Tracker::do_inhibit = !Tracker::do_inhibit;
+ qDebug() << "Tracker::run() says Inhibit pressed";
+ //
+ // Execute Center command too, when inhibition ends.
+ //
+ if (!Tracker::do_inhibit) {
+ Tracker::do_center = true;
+ }
+ }
+ lastInhibitKey = isShortKeyPressed( &InhibitKey, &keystate[0] ); // Remember
+
}
}
@@ -518,6 +538,17 @@ void Tracker::run() {
}
posZ = Z.invert * getOutputFromCurve(&Z.curve, posZ, Z.NeutralZone, Z.MaxInput);
+ //
+ // Reset value for the selected axis, if inhibition is active
+ //
+ if (Tracker::do_inhibit) {
+ if (InhibitKey.doPitch) rotX = 0.0f;
+ if (InhibitKey.doYaw) rotY = 0.0f;
+ if (InhibitKey.doRoll) rotZ = 0.0f;
+ if (InhibitKey.doX) posX = 0.0f;
+ if (InhibitKey.doY) posY = 0.0f;
+ if (InhibitKey.doZ) posZ = 0.0f;
+ }
//
// Send the Virtual Pose to selected Protocol-Server
@@ -1005,6 +1036,18 @@ QPointF point1, point2, point3, point4;
StartStopKey.ctrl = iniFile.value ( "Ctrl_StartStop", 0 ).toBool();
StartStopKey.alt = iniFile.value ( "Alt_StartStop", 0 ).toBool();
+ // Inhibit key
+ InhibitKey.keycode = iniFile.value ( "Keycode_Inhibit", 0 ).toInt();
+ InhibitKey.shift = iniFile.value ( "Shift_Inhibit", 0 ).toBool();
+ InhibitKey.ctrl = iniFile.value ( "Ctrl_Inhibit", 0 ).toBool();
+ InhibitKey.alt = iniFile.value ( "Alt_Inhibit", 0 ).toBool();
+ InhibitKey.doPitch = iniFile.value ( "Inhibit_Pitch", 0 ).toBool();
+ InhibitKey.doYaw = iniFile.value ( "Inhibit_Yaw", 0 ).toBool();
+ InhibitKey.doRoll = iniFile.value ( "Inhibit_Roll", 0 ).toBool();
+ InhibitKey.doX = iniFile.value ( "Inhibit_X", 0 ).toBool();
+ InhibitKey.doY = iniFile.value ( "Inhibit_Y", 0 ).toBool();
+ InhibitKey.doZ = iniFile.value ( "Inhibit_Z", 0 ).toBool();
+
iniFile.endGroup ();
}
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 8b7b13f1..277c11ca 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -97,6 +97,12 @@ struct TShortKey {
bool shift; // Modifiers to examine
bool ctrl;
bool alt;
+ bool doPitch; // Modifiers to act on axis
+ bool doYaw;
+ bool doRoll;
+ bool doX;
+ bool doY;
+ bool doZ;
};
class Tracker : public QThread {
@@ -132,12 +138,14 @@ private:
static TShortKey CenterKey; // ShortKey to Center headposition
static TShortKey StartStopKey; // ShortKey to Start/stop tracking
+ static TShortKey InhibitKey; // ShortKey to one or more axis during tracking
// Flags to start/stop/reset tracking
static bool confid; // Tracker data is OK
static bool set_initial; // initial headpose is set
- static bool do_tracking; // Start/stop tracking, using MINUS key on keyboard
- static bool do_center; // Center head-position, using EQUALS key on keyboard
+ static bool do_tracking; // Start/stop tracking, using the shortkey
+ static bool do_center; // Center head-position, using the shortkey
+ static bool do_inhibit; // Inhibit DOF-axis, using the shortkey
static bool useFilter;
static long prevHeadPoseTime; // Time from previous sample
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index c8ae7003..de1532da 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ