diff options
| author | Tim Redfern <tim@getdrop.com> | 2017-10-30 17:09:10 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2017-10-30 17:09:10 +0000 |
| commit | 633aee47fb7392b807e00e1827fad605fb68642b (patch) | |
| tree | f873162e6ad70db1e11164334212f1e4835eaba9 | |
| parent | 1d2e4b56b0104b36da79b3fa5762645e85ccea3a (diff) | |
drag drop json presets
| -rw-r--r-- | gui/src/chainImageSet.cpp | 17 | ||||
| -rw-r--r-- | gui/src/chainImageSet.h | 1 | ||||
| -rw-r--r-- | gui/src/ofApp.cpp | 41 |
3 files changed, 50 insertions, 9 deletions
diff --git a/gui/src/chainImageSet.cpp b/gui/src/chainImageSet.cpp index 9f2cfcc..1036e4a 100644 --- a/gui/src/chainImageSet.cpp +++ b/gui/src/chainImageSet.cpp @@ -244,6 +244,23 @@ save dragdrop pos in loadingImages and attempt to insert in the chain //return false; } +bool chainImageSet::addfiles(std::vector<string> &filenames){ + + for (auto f=filenames.begin();f!=filenames.end();f++){ + if(f->substr(f->find_last_of(".") + 1) == "json") { + images.clear(); + bool success=loadJson(*f); + + ofLogVerbose("Load %s %s\n", + f->c_str(), + success?"succeeded":"failed"); + } + else { + add(*f); + } + } + +} void chainImageSet::keyPressed(ofKeyEventArgs &keyargs){ //printf("Got key %i, modifiers:%i\n",keyargs.key,keyargs.modifiers); diff --git a/gui/src/chainImageSet.h b/gui/src/chainImageSet.h index 879329a..6620923 100644 --- a/gui/src/chainImageSet.h +++ b/gui/src/chainImageSet.h @@ -29,6 +29,7 @@ class chainImageSet{ void drawOutput(); void drawGpu(); void updateOutput(); + bool addfiles(std::vector<string> &filenames); bool add(std::string filename,ofPoint pos=ofPoint(0,0),float ratio=0.3,float rotation=0.0); void keyPressed(ofKeyEventArgs &keyargs); void mouseDragged(int x, int y, int button); diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index a89a893..43f51f1 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -229,6 +229,29 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { } + //column 2 for more controls + offet=2; + + if (msg.channel==1&&msg.control==1+offet){ + //pot 1 + for (int i=0;i<sets.size();i++){ + //sets[i].zoomMultiplier=1.0f+(((float)msg.value-64)/64.0f); doesn't work + }; + + printf("Val %i, zoomMultiplier: %f \n",msg.value,sets[0].fitFactor); + } + if (msg.channel==1&&msg.control==65+offet){ + //top button 1 + + } + if (msg.channel==1&&msg.control==73+offet){ + //bottom button 1 + } + if (msg.channel==1&&msg.control==81+offet){ + //fader 1 + + } + } //-------------------------------------------------------------- @@ -322,20 +345,20 @@ void ofApp::gotMessage(ofMessage msg){ //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ - std::string filenames; + //std::string filenames; - for (auto f = dragInfo.files.begin(); f != dragInfo.files.end(); f++){ - if (f!=dragInfo.files.begin()){ - filenames=filenames+", "; - } - filenames=filenames+*f; + //for (auto f = dragInfo.files.begin(); f != dragInfo.files.end(); f++){ + // if (f!=dragInfo.files.begin()){ + // filenames=filenames+", "; + // } + // filenames=filenames+*f; if (dragInfo.position.y<200){ - sets[0].add(*f); //,dragInfo.position); + sets[0].addfiles(dragInfo.files); //,dragInfo.position); } - else sets[1].add(*f); //,dragInfo.position); + else sets[1].addfiles(dragInfo.files); //,dragInfo.position); - } + //} } |
