@@ -58,6 +58,7 @@ ofxVisualProgramming::ofxVisualProgramming(){
5858 isRetina = false ;
5959 scaleFactor = 1 ;
6060
61+ actualObjectID = 0 ;
6162 lastAddedObjectID = -1 ;
6263 bLoadingNewObject = false ;
6364 bLoadingNewPatch = false ;
@@ -74,7 +75,7 @@ ofxVisualProgramming::ofxVisualProgramming(){
7475 subpatchesTree[currentSubpatch] = rootBranch;
7576
7677 resetTime = ofGetElapsedTimeMillis ();
77- wait = 2000 ;
78+ wait = 1000 ;
7879
7980 alphabet = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXZY" ;
8081 newFileCounter = 0 ;
@@ -887,6 +888,19 @@ void ofxVisualProgramming::clearObjectsMap(){
887888 }
888889}
889890
891+ // --------------------------------------------------------------
892+ string ofxVisualProgramming::getSubpatchParent (string subpatchName){
893+ for (map<string,vector<string>>::iterator it = subpatchesTree.begin (); it != subpatchesTree.end (); it++ ){
894+ for (int s=0 ;s<it->second .size ();s++){
895+ if (it->second .at (s) == subpatchName){
896+ return it->first ;
897+ }
898+ }
899+ }
900+ // return root if subpatch searched do not exists
901+ return " root" ;
902+ }
903+
890904// --------------------------------------------------------------
891905void ofxVisualProgramming::removeObject (int &id){
892906 resetTime = ofGetElapsedTimeMillis ();
@@ -1069,16 +1083,14 @@ void ofxVisualProgramming::resetSpecificSystemObjects(string name){
10691083
10701084// --------------------------------------------------------------
10711085bool ofxVisualProgramming::weAlreadyHaveObject (string name){
1072- bool found = false ;
10731086
10741087 for (map<int ,shared_ptr<PatchObject>>::iterator it = patchObjects.begin (); it != patchObjects.end (); it++ ){
10751088 if (it->second ->getName () == name){
1076- found = true ;
1077- break ;
1089+ return true ;
10781090 }
10791091 }
10801092
1081- return found ;
1093+ return false ;
10821094}
10831095
10841096// --------------------------------------------------------------
@@ -1131,6 +1143,8 @@ void ofxVisualProgramming::preloadPatch(string patchFile){
11311143 currentPatchFile = patchFile;
11321144 tempPatchFile = currentPatchFile;
11331145
1146+ actualObjectID = 0 ;
1147+
11341148 // clear previous patch
11351149 for (map<int ,shared_ptr<PatchObject>>::iterator it = patchObjects.begin (); it != patchObjects.end (); it++ ){
11361150 if (it->second ->getName () != " audio device" ){
@@ -1143,8 +1157,10 @@ void ofxVisualProgramming::preloadPatch(string patchFile){
11431157
11441158 it->second ->outPut .clear ();
11451159
1146- glm::vec3 temp = canvas.screenToWorld (glm::vec3 (ofGetWindowWidth ()/2 ,ofGetWindowHeight ()/2 + 100 ,0 ));
1147- it->second ->move (temp.x ,temp.y );
1160+ // glm::vec3 temp = canvas.screenToWorld(glm::vec3(ofGetWindowWidth()/2,ofGetWindowHeight()/2 + 100,0));
1161+ // it->second->move(temp.x,temp.y);
1162+ it->second ->setWillErase (true );
1163+
11481164 }
11491165 }
11501166 resetTime = ofGetElapsedTimeMillis ();
@@ -1359,6 +1375,8 @@ void ofxVisualProgramming::loadPatch(string patchFile){
13591375 }
13601376 }
13611377
1378+ activateDSP ();
1379+
13621380 bLoadingNewPatch = false ;
13631381
13641382}
0 commit comments