Visage toggle bits.

This commit is contained in:
Andrzej Kapolka 2014-03-13 15:17:16 -07:00
parent 5b30f932c1
commit fc32d9581d
5 changed files with 42 additions and 24 deletions

View file

@ -113,18 +113,18 @@
<context>
<name>Menu</name>
<message>
<location filename="src/Menu.cpp" line="422"/>
<location filename="src/Menu.cpp" line="427"/>
<source>Open .ini config file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="424"/>
<location filename="src/Menu.cpp" line="436"/>
<location filename="src/Menu.cpp" line="429"/>
<location filename="src/Menu.cpp" line="441"/>
<source>Text files (*.ini)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="434"/>
<location filename="src/Menu.cpp" line="439"/>
<source>Save .ini config file</source>
<translation type="unfinished"></translation>
</message>

View file

@ -270,11 +270,16 @@ Menu::Menu() :
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::LookAtVectors, 0, false);
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu,
MenuOption::FaceshiftTCP,
MenuOption::Faceshift,
0,
false,
true,
appInstance->getFaceshift(),
SLOT(setTCPEnabled(bool)));
#ifdef HAVE_VISAGE
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Visage, 0, true,
appInstance->getVisage(), SLOT(setEnabled(bool)));
#endif
addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, false);
QMenu* handOptionsMenu = developerMenu->addMenu("Hand Options");

View file

@ -239,7 +239,7 @@ namespace MenuOption {
const QString DontFadeOnVoxelServerChanges = "Don't Fade In/Out on Voxel Server Changes";
const QString HeadMouse = "Head Mouse";
const QString HandsCollideWithSelf = "Collide With Self";
const QString FaceshiftTCP = "Faceshift (TCP)";
const QString Faceshift = "Faceshift";
const QString FirstPerson = "First Person";
const QString FrameTimer = "Show Timer";
const QString FrustumRenderMode = "Render Mode";
@ -292,6 +292,7 @@ namespace MenuOption {
const QString StopAllScripts = "Stop All Scripts";
const QString TestPing = "Test Ping";
const QString TransmitterDrive = "Transmitter Drive";
const QString Visage = "Visage";
const QString Quit = "Quit";
const QString Voxels = "Voxels";
const QString VoxelMode = "Cycle Voxel Mode";

View file

@ -40,25 +40,11 @@ Visage::Visage() :
#ifdef HAVE_VISAGE
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc";
initializeLicenseManager(licensePath.data());
_tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg");
if (_tracker->trackFromCam()) {
_data = new FaceData();
} else {
delete _tracker;
_tracker = NULL;
}
#endif
}
Visage::~Visage() {
#ifdef HAVE_VISAGE
if (_tracker) {
_tracker->stop();
delete _tracker;
delete _data;
}
#endif
setEnabled(false);
}
#ifdef HAVE_VISAGE
@ -160,3 +146,23 @@ void Visage::update() {
void Visage::reset() {
_headOrigin += _headTranslation / TRANSLATION_SCALE;
}
void Visage::setEnabled(bool enabled) {
#ifdef HAVE_VISAGE
if (enabled == (_tracker != NULL)) {
return;
}
if (enabled) {
_tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg");
_data = new FaceData();
if (_tracker->trackFromCam()) {
return;
}
}
_tracker->stop();
delete _tracker;
delete _data;
_tracker = NULL;
_data = NULL;
#endif
}

View file

@ -24,11 +24,13 @@ namespace VisageSDK {
}
/// Handles input from the Visage webcam feature tracking software.
class Visage {
class Visage : public QObject {
Q_OBJECT
public:
Visage();
~Visage();
virtual ~Visage();
bool isActive() const { return _active; }
@ -42,6 +44,10 @@ public:
void update();
void reset();
public slots:
void setEnabled(bool enabled);
private: