diff --git a/osc-modules/FaceTracker2OSC/addons.make b/osc-modules/FaceTracker2OSC/addons.make index 3c927cd..3e53704 100644 --- a/osc-modules/FaceTracker2OSC/addons.make +++ b/osc-modules/FaceTracker2OSC/addons.make @@ -1,5 +1,6 @@ -ofxControl ofxCv ofxFaceTracker2 +ofxGui ofxOpenCv ofxOsc +ofxXmlSettings diff --git a/osc-modules/FaceTracker2OSC/src/ofApp.cpp b/osc-modules/FaceTracker2OSC/src/ofApp.cpp index 11a5a1f..e4f7621 100644 --- a/osc-modules/FaceTracker2OSC/src/ofApp.cpp +++ b/osc-modules/FaceTracker2OSC/src/ofApp.cpp @@ -12,7 +12,7 @@ void ofApp::setup(){ oscPort = OSC_PORT_DEFAULT; // load settings from file - ofXml xml; + ofxXmlSettings xml; xml.load("settings_facetracker2.xml"); // xml.setTo("FaceTracker2OSC"); // oscDestination = xml.getValue("ip"); @@ -20,9 +20,9 @@ void ofApp::setup(){ // oscAddress = xml.getValue("address"); - oscDestination = xml.getChild("FaceTracker2OSC").getChild("ip").getValue(); - oscPort = ofToInt(xml.getChild("FaceTracker2OSC").getChild("port").getValue()); - oscAddress = xml.getChild("FaceTracker2OSC").getChild("address").getValue(); + oscDestination = xml.getValue("FaceTracker2OSC:ip", OSC_DESTINATION_DEFAULT); + oscPort = xml.getValue("FaceTracker2OSC:port", OSC_PORT_DEFAULT); + oscAddress = xml.getValue("FaceTracker2OSC:address", OSC_ADDRESS_ROOT_DEFAULT); // setup tracker and cam @@ -33,9 +33,10 @@ void ofApp::setup(){ osc.setup(oscDestination, oscPort); // setup gui - gui.setName("FaceTracker2OSC"); - gui.setPosition(12, 60); - gui.addToggle("normalize", &normalize); + gui.setup(); + gui.setPosition(12, 60); + gui.setName("FaceTracker2OSC"); + gui.add(normalize.set("normalize", true)); } //-------------------------------------------------------------- @@ -53,7 +54,7 @@ void ofApp::update(){ } ofxFaceTracker2Landmarks landmarks = instances[0].getLandmarks(); - vector points = landmarks.getImagePoints(); + vector points = landmarks.getImagePoints(); ofRectangle bb = instances[0].getBoundingBox(); ofxOscMessage msg; @@ -84,5 +85,7 @@ void ofApp::draw(){ ofDrawBitmapStringHighlight("Tracker thread framerate : "+ofToString(tracker.getThreadFps()), 10, 40); ofSetColor(255); - ofDrawBitmapStringHighlight(oscMessageString, 15, ofGetHeight() - 4); + ofDrawBitmapStringHighlight(oscMessageString, 15, ofGetHeight() - 4); + + gui.draw(); } diff --git a/osc-modules/FaceTracker2OSC/src/ofApp.h b/osc-modules/FaceTracker2OSC/src/ofApp.h index 776124c..55f91cb 100644 --- a/osc-modules/FaceTracker2OSC/src/ofApp.h +++ b/osc-modules/FaceTracker2OSC/src/ofApp.h @@ -3,7 +3,8 @@ #include "ofMain.h" #include "ofxFaceTracker2.h" #include "ofxOsc.h" -#include "ofxControl.h" +#include "ofxXmlSettings.h" +#include "ofxGui.h" #define OSC_DESTINATION_DEFAULT "localhost" #define OSC_ADDRESS_ROOT_DEFAULT "/wek/inputs" @@ -24,6 +25,7 @@ class ofApp : public ofBaseApp{ int oscPort; string oscMessageString; - bool normalize; - ofxControlWidget gui; + ofParameter normalize; + + ofxPanel gui; };