From c98efcbfdebd2e6ce85cb1b3b08a1bc48f3d968b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 Apr 2013 23:49:49 +0200 Subject: Always load alternative curve settings, not just after dialog open --- facetracknoir/facetracknoir.cpp | 49 ++++++++++++++++++----------------------- facetracknoir/facetracknoir.h | 2 ++ facetracknoir/tracker.cpp | 10 ++++++--- facetracknoir/tracker.h | 12 +++++----- 4 files changed, 36 insertions(+), 37 deletions(-) (limited to 'facetracknoir') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 2fb07baa..7442940f 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -740,6 +740,10 @@ void FaceTrackNoIR::startTracker( ) { delete tracker; } + if (GlobalPose) + delete GlobalPose; + GlobalPose = new HeadPoseData(); + tracker = new Tracker ( this ); // @@ -1840,52 +1844,41 @@ QWidget( parent , f) mainApp = ftnoir; // Preserve a pointer to FTNoIR - // Connect Qt signals to member-functions - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); ui.txconfig->setConfig(GlobalPose->X.curvePtr, currentFile); - connect(ui.txconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + ui.tyconfig->setConfig(GlobalPose->Y.curvePtr, currentFile); + ui.tzconfig->setConfig(GlobalPose->Z.curvePtr, currentFile); + ui.rxconfig->setConfig(GlobalPose->Yaw.curvePtr, currentFile); + ui.ryconfig->setConfig(GlobalPose->Pitch.curvePtr, currentFile); + ui.rzconfig->setConfig(GlobalPose->Roll.curvePtr, currentFile); + ui.txconfig_alt->setConfig(GlobalPose->X.curvePtrAlt, currentFile); + ui.tyconfig_alt->setConfig(GlobalPose->Y.curvePtrAlt, currentFile); + ui.tzconfig_alt->setConfig(GlobalPose->Z.curvePtrAlt, currentFile); + ui.rxconfig_alt->setConfig(GlobalPose->Yaw.curvePtrAlt, currentFile); + ui.ryconfig_alt->setConfig(GlobalPose->Pitch.curvePtrAlt, currentFile); + ui.rzconfig_alt->setConfig(GlobalPose->Roll.curvePtrAlt, currentFile); - ui.txconfig->setConfig(GlobalPose->X.curvePtr, currentFile); + // Connect Qt signals to member-functions + connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + + connect(ui.txconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); connect(ui.txconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - ui.tyconfig->setConfig(GlobalPose->Y.curvePtr, currentFile); - connect(ui.tyconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - ui.tzconfig->setConfig(GlobalPose->Z.curvePtr, currentFile); + connect(ui.tyconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); connect(ui.tzconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.rxconfig->setConfig(GlobalPose->Yaw.curvePtr, currentFile); connect(ui.rxconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.ryconfig->setConfig(GlobalPose->Pitch.curvePtr, currentFile); connect(ui.ryconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.rzconfig->setConfig(GlobalPose->Roll.curvePtr, currentFile); connect(ui.rzconfig, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.txconfig_alt->setConfig(GlobalPose->X.curvePtrAlt, currentFile); connect(ui.txconfig_alt, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.tyconfig_alt->setConfig(GlobalPose->Y.curvePtrAlt, currentFile); connect(ui.tyconfig_alt, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.tzconfig_alt->setConfig(GlobalPose->Z.curvePtrAlt, currentFile); connect(ui.tzconfig_alt, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.rxconfig_alt->setConfig(GlobalPose->Yaw.curvePtrAlt, currentFile); connect(ui.rxconfig_alt, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.ryconfig_alt->setConfig(GlobalPose->Pitch.curvePtrAlt, currentFile); connect(ui.ryconfig_alt, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - - ui.rzconfig_alt->setConfig(GlobalPose->Roll.curvePtrAlt, currentFile); connect(ui.rzconfig_alt, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(ui.rx_altp, SIGNAL(stateChanged(int)), this, SLOT(curveChanged(int))); connect(ui.ry_altp, SIGNAL(stateChanged(int)), this, SLOT(curveChanged(int))); connect(ui.rz_altp, SIGNAL(stateChanged(int)), this, SLOT(curveChanged(int))); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index df87cc8c..e59c2190 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -335,4 +335,6 @@ public: void run() { KeybindingWorkerDummy::run(); } + + }; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index f624d6a1..c3a61263 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -170,8 +170,6 @@ void Tracker::run() { bTracker1Confid = Libraries->pTracker->GiveHeadPoseData(&newpose); } - confid = (bTracker1Confid || bTracker2Confid); - bool newp = last.yaw != newpose.yaw || last.pitch != newpose.pitch || last.roll != newpose.roll || @@ -291,13 +289,19 @@ void Tracker::run() { GlobalPose->Z.curvePtr->setTrackingActive( false ); GlobalPose->Yaw.curvePtr->setTrackingActive( false ); GlobalPose->Pitch.curvePtr->setTrackingActive( false ); - GlobalPose->Pitch.curvePtrAlt->setTrackingActive( false ); GlobalPose->Roll.curvePtr->setTrackingActive( false ); + GlobalPose->X.curvePtrAlt->setTrackingActive( false ); + GlobalPose->Y.curvePtrAlt->setTrackingActive( false ); + GlobalPose->Z.curvePtrAlt->setTrackingActive( false ); + GlobalPose->Yaw.curvePtrAlt->setTrackingActive( false ); + GlobalPose->Pitch.curvePtrAlt->setTrackingActive( false ); + GlobalPose->Roll.curvePtrAlt->setTrackingActive( false ); if (Libraries->pFilter) Libraries->pFilter->Initialize(); } //for lower cpu load + confid = (bTracker1Confid || bTracker2Confid); usleep(1000); } diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 3810aafc..d67fc533 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -191,12 +191,12 @@ public: THeadPoseDOF Y; THeadPoseDOF Z; HeadPoseData() : - Pitch("PitchUp", "PitchDown", 60, 180, 60, 90), - Yaw("Yaw", "YawAlt", 60, 180, 60, 180), - Roll("Roll", "RollAlt", 60, 180, 60, 180), - X("X","XAlt", 60, 200, 60, 200), - Y("Y","YAlt", 60, 200, 60, 200), - Z("Z","ZAlt", 60, 200, 60, 200) + Pitch("ry", "ry_alt", 60, 180, 60, 90), + Yaw("rx", "rx_alt", 60, 180, 60, 180), + Roll("rz", "rz_alt", 60, 180, 60, 180), + X("tx","tx_alt", 60, 200, 60, 200), + Y("ty","ty_alt", 60, 200, 60, 200), + Z("tz","tz_alt", 60, 200, 60, 200) { } }; -- cgit v1.2.3