Skip to content

Commit

Permalink
remove ofxControl
Browse files Browse the repository at this point in the history
  • Loading branch information
genekogan committed Apr 7, 2019
1 parent 116b880 commit b0dce43
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
3 changes: 2 additions & 1 deletion osc-modules/FaceTracker2OSC/addons.make
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ofxControl
ofxCv
ofxFaceTracker2
ofxGui
ofxOpenCv
ofxOsc
ofxXmlSettings
21 changes: 12 additions & 9 deletions osc-modules/FaceTracker2OSC/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ 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");
// oscPort = ofToInt(xml.getValue("port"));
// 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
Expand All @@ -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));
}

//--------------------------------------------------------------
Expand All @@ -53,7 +54,7 @@ void ofApp::update(){
}

ofxFaceTracker2Landmarks landmarks = instances[0].getLandmarks();
vector<ofVec2f> points = landmarks.getImagePoints();
vector<glm::vec2> points = landmarks.getImagePoints();
ofRectangle bb = instances[0].getBoundingBox();

ofxOscMessage msg;
Expand Down Expand Up @@ -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();
}
8 changes: 5 additions & 3 deletions osc-modules/FaceTracker2OSC/src/ofApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -24,6 +25,7 @@ class ofApp : public ofBaseApp{
int oscPort;
string oscMessageString;

bool normalize;
ofxControlWidget gui;
ofParameter<bool> normalize;

ofxPanel gui;
};

0 comments on commit b0dce43

Please sign in to comment.