Skip to content

Commit

Permalink
tweaks for reduced track list
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed Oct 21, 2014
1 parent c42212e commit 0f954fe
Show file tree
Hide file tree
Showing 6 changed files with 2,892 additions and 144 deletions.
152 changes: 34 additions & 118 deletions CloudsClipEvaluator/src/testApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void testApp::setup(){
ofEnableSmoothing();

currentAct = NULL;
rebuildAct = false;
//rebuildAct = false;

parser.loadFromFiles();
parser.loadMediaAssets();
Expand All @@ -21,42 +21,54 @@ void testApp::setup(){

storyEngine.setup();

vector<CloudsClip*> clips = storyEngine.getStartingQuestions();
random_shuffle(clips.begin(), clips.end());

for(int i = 0; i < clips.size(); i++){
for(int run = 0; run < 10; run++){
vector<CloudsClip*> clips = storyEngine.getStartingQuestions();
random_shuffle(clips.begin(), clips.end());

CloudsClip* clip = clips[i];
string topic = clip->getAllQuestionTopicPairs().begin()->first;
CloudsRun run;
exploreAct(clip,topic,true,run,0,10);
for(int i = 0; i < clips.size(); i++){

CloudsClip* clip = clips[i];
string topic = clip->getAllQuestionTopicPairs().begin()->first;
CloudsRun run;
exploreAct(clip,topic,true,run,0,10);

}

}

set<CloudsClip*>::iterator it;
map<CloudsClip*,int>::iterator it;
int clipid = 0;
for(it = traversedClips.begin(); it != traversedClips.end(); it++){
cout << clipid++ << "/" << traversedClips.size() << " " << (*it)->getLinkName() << endl;
cout << "(" << it->second << ") " << clipid++ << "/" << traversedClips.size() << " " << it->first->getLinkName() << endl;
}

cout << "INCLUDED CLIPS" << endl;
ofBuffer shellscript;
shellscript.append("#!/bin/bash\n");
for(it = traversedClips.begin(); it != traversedClips.end(); it++){
CloudsClip* clip = *it;
CloudsClip* clip = it->first;
if(clip->hasMediaAsset){
string mediaFile = ofToDataPath(clip->combinedVideoPath,true);
string xmlFile = ofToDataPath(clip->combinedCalibrationXMLPath,true);
string containingFolder = ofFilePath::addTrailingSlash(ofFilePath::getEnclosingDirectory( mediaFile));

shellscript.append(string("echo \"copying ") + ofFilePath::getFileName(mediaFile) + "\"\n" );
shellscript.append(string("cp \"") + mediaFile + "\" \"" + containingFolder + "__keepers/\"\n" );
shellscript.append(string("cp \"") + xmlFile + "\" \"" + containingFolder + "__keepers/\"\n\n" );
shellscript.append(string("cp \"") + xmlFile + "\" \"" + containingFolder + "__keepers/\"\n\n");

//cout << clip->getLinkName()<<endl;
}
}

ofBufferToFile(GetCloudsDataPath()+"copyscript.sh", shellscript);

//ofAddListener(storyEngine.getEvents().actCreated, this, &testApp::actCreated);
cout << "EXCLUDED CLIPS" << endl;
for(int i = 0; i < parser.getAllClips().size(); i++){
if(traversedClips.find(parser.getAllClips()[i]) == traversedClips.end()){
cout << parser.getAllClips()[i]->getLinkName() << endl;
}
}

}

//--------------------------------------------------------------
Expand All @@ -67,11 +79,15 @@ void testApp::exploreAct(CloudsClip* clip, string topic, bool playSeed, CloudsRu

if(topic == ""){
ofLogError("TOPIC IS BLANK");
return;
}

CloudsAct* act = storyEngine.buildAct(storyEngine.runTest, clip, topic, playSeed);
copy( act->getAllClips().begin(), act->getAllClips().end(), inserter( traversedClips, traversedClips.end() ) );

//copy( act->getAllClips().begin(), act->getAllClips().end(), inserter( traversedClips, traversedClips.end() ) );
for(int i = 0; i < act->getAllClips().size(); i++){
traversedClips[act->getAllClips()[i]]++;
}

for(int c = 0; c < act->getAllQuestions().size(); c++){
if(traversedClips.find(act->getAllQuestions()[c].first) == traversedClips.end()){
cout << "TAKING QUESTION " << act->getAllQuestions()[c].first->getLinkName() << " with TOPIC " << act->getAllQuestions()[c].second << " DEPTTH " << depth+1 << "/" << maxDepth << endl;
Expand All @@ -88,124 +104,24 @@ void testApp::exploreAct(CloudsClip* clip, string topic, bool playSeed, CloudsRu
delete act;
}

//--------------------------------------------------------------
void testApp::actCreated(CloudsActEventArgs& args){

if(currentAct != NULL){
currentAct->unregisterEvents(this);
delete currentAct;
}

currentAct = args.act;
currentAct->registerEvents(this);
currentAct->play();
currentAct->getTimeline().enableEvents();
}

//--------------------------------------------------------------
void testApp::actBegan(CloudsActEventArgs& args){
}

//--------------------------------------------------------------
void testApp::actEnded(CloudsActEventArgs& args){

}

//--------------------------------------------------------------
void testApp::clipBegan(CloudsClipEventArgs& args){

}

//--------------------------------------------------------------
void testApp::visualSystemBegan(CloudsVisualSystemEventArgs& args){

}

//--------------------------------------------------------------
void testApp::visualSystemEnded(CloudsVisualSystemEventArgs& args){

}

//--------------------------------------------------------------
void testApp::topicChanged(CloudsTopicEventArgs& newTopic){

}

void testApp::questionProposed(CloudsQuestionEventArgs& args){

}

void testApp::questionSelected(CloudsQuestionEventArgs& args){

}

void testApp::preRollRequested(CloudsPreRollEventArgs& clip){

}
//--------------------------------------------------------------
void testApp::update(){

}

//--------------------------------------------------------------
void testApp::draw(){
if(currentAct != NULL){
currentAct->drawDebug();
}

}

//--------------------------------------------------------------
void testApp::exit(){
storyEngine.saveGuiSettings();
}

//--------------------------------------------------------------
void testApp::guiEvent(ofxUIEventArgs &e)
{
string name = e.widget->getName();
ofxUIButton* b = (ofxUIButton*) e.widget;
if(name == "BUILD ACT" && b->getValue() ){
rebuildAct = true;
}

}

//--------------------------------------------------------------
void testApp::keyPressed(int key){

if(key == 'h'){
storyEngine.toggleGuis();
}
else if(key =='f'){
ofToggleFullscreen();
}
if(key == 't'){
storyEngine.positionGuis();
}
if(key == 'S'){
storyEngine.saveGuiSettings();
}

#ifndef CLOUDS_NO_OSC
if(key == 'E'){
vector<int> projectExampleIndecs;
for(int i = 0; i < parser.getAllClips().size(); i++){
if(parser.getAllClips()[i].hasProjectExample){
projectExampleIndecs.push_back(i);
}
}

if(projectExampleIndecs.size() > 0){
int exampleIndex = projectExampleIndecs[ ofRandom(projectExampleIndecs.size()) ];
oscSender.sendClip( parser.getAllClips()[exampleIndex]);
cout << "SENT CLIP " << parser.getAllClips()[exampleIndex].getLinkName() << " WITH EXAMPLE " << parser.getAllClips()[exampleIndex].projectExampleTitle << endl;
}
}

if(key == 'C'){
oscSender.sendClip( parser.getAllClips()[ ofRandom(parser.getAllClips().size()) ] );
}
#endif


}

Expand Down
23 changes: 1 addition & 22 deletions CloudsClipEvaluator/src/testApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,8 @@ class testApp : public ofBaseApp{
CloudsAct* currentAct;
CloudsRun run;

set<CloudsClip*> traversedClips;
map<CloudsClip*, int> traversedClips;
void exploreAct(CloudsClip* starter, string topic, bool playSeed, CloudsRun run, int depth, int maxDepth);

#ifndef CLOUDS_NO_OSC
CloudsSecondaryDisplayOSCSender oscSender;
#endif
//clip events
void actCreated(CloudsActEventArgs& args);
void actBegan(CloudsActEventArgs& args);
void actEnded(CloudsActEventArgs& args);
void clipBegan(CloudsClipEventArgs& args);
void visualSystemBegan(CloudsVisualSystemEventArgs& args);
void visualSystemEnded(CloudsVisualSystemEventArgs& args);
void questionProposed(CloudsQuestionEventArgs& args);
void questionSelected(CloudsQuestionEventArgs& args);
void topicChanged(CloudsTopicEventArgs& newTopic);
void preRollRequested(CloudsPreRollEventArgs& clip);

bool rebuildAct;
ofxUISuperCanvas *gui;
ofxUISuperCanvas *clipGui;
bool displayGui;

void guiEvent(ofxUIEventArgs &e);

};
Loading

0 comments on commit 0f954fe

Please sign in to comment.