3030
3131==============================================================================*/
3232
33- #if defined(TARGET_WIN32)
34- // Unavailable on windows.
35- #elif !defined(OFXVP_BUILD_WITH_MINIMAL_OBJECTS)
33+ #ifndef OFXVP_BUILD_WITH_MINIMAL_OBJECTS
3634
3735#include " PDPatch.h"
3836
@@ -65,14 +63,10 @@ PDPatch::PDPatch() : PatchObject("pd patch"){
6563 isAudioOUTObject = true ;
6664
6765 lastLoadedPatch = " " ;
68- prevExternalsFolder = " /path_to_pd_externals" ;
69- lastExternalsFolder = " SET PD EXTERNAL FOLDER!" ;
7066 loadPatchFlag = false ;
7167 savePatchFlag = false ;
72- setExternalFlag = false ;
7368 patchLoaded = false ;
7469 patchSaved = false ;
75- externalPathSaved = false ;
7670 loading = true ;
7771
7872 isPDSPPatchableObject = true ;
@@ -96,8 +90,6 @@ void PDPatch::newObject(){
9690 this ->addOutlet (VP_LINK_AUDIO," audioOut3" );
9791 this ->addOutlet (VP_LINK_AUDIO," audioOut4" );
9892 this ->addOutlet (VP_LINK_ARRAY," data" );
99-
100- this ->setCustomVar (0 .0f ," /path_to_pd_externals" );
10193}
10294
10395// --------------------------------------------------------------
@@ -171,28 +163,6 @@ void PDPatch::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjects
171163 this ->saveConfig (false );
172164 }
173165
174- if (externalPathSaved){
175- externalPathSaved = false ;
176- if (lastExternalsFolder != " " ){
177- ofFile tempfile (lastExternalsFolder);
178- if (tempfile.exists () && tempfile.isDirectory ()){
179- string temp = tempfile.getAbsolutePath ().substr (0 , tempfile.getAbsolutePath ().size ()-1 );
180- pd.addToSearchPath (temp);
181- this ->substituteCustomVar (prevExternalsFolder,temp.c_str ());
182- prevExternalsFolder = lastExternalsFolder;
183- ofLog (OF_LOG_NOTICE," PD Externals Folder set to: %s" ,temp.c_str ());
184- this ->saveConfig (false );
185- // load externals
186- #if defined(TARGET_LINUX) || defined(TARGET_OSX)
187- if (lastExternalsFolder != " SET PD EXTERNAL FOLDER!" ){
188- cyclone_setup ();
189- zexy_setup ();
190- }
191- #endif
192- }
193- }
194- }
195-
196166 if (pd.isInited () && pd.isComputingAudio () && currentPatch.isValid ()){
197167 pd.startMessage ();
198168 for (size_t s=0 ;s<static_cast <size_t >(static_cast <vector<float > *>(_inletParams[4 ])->size ());s++){
@@ -225,7 +195,6 @@ void PDPatch::drawObjectContent(ofTrueTypeFont *font, shared_ptr<ofBaseGLRendere
225195void PDPatch::drawObjectNodeGui ( ImGuiEx::NodeCanvas& _nodeCanvas ){
226196 loadPatchFlag = false ;
227197 savePatchFlag = false ;
228- setExternalFlag = false ;
229198
230199 // CONFIG GUI inside Menu
231200 if (_nodeCanvas.BeginNodeMenu ()){
@@ -267,11 +236,6 @@ void PDPatch::drawObjectNodeGui( ImGuiEx::NodeCanvas& _nodeCanvas ){
267236 patchLoaded = true ;
268237 }
269238
270- if (ImGuiEx::getFileDialog (fileDialog, setExternalFlag, " Select your PD external folder" , imgui_addons::ImGuiFileBrowser::DialogMode::SELECT, " " , " " , scaleFactor)){
271- lastExternalsFolder = fileDialog.selected_path ;
272- externalPathSaved = true ;
273- }
274-
275239}
276240
277241// --------------------------------------------------------------
@@ -280,7 +244,6 @@ void PDPatch::drawObjectNodeConfig(){
280244
281245 loadPatchFlag = false ;
282246 savePatchFlag = false ;
283- setExternalFlag = false ;
284247
285248 ImGui::Spacing ();
286249 ImGui::Text (" Loaded PD Patch:" );
@@ -290,8 +253,6 @@ void PDPatch::drawObjectNodeConfig(){
290253 ImGui::Text (" %s" ,tempFilename.getFileName ().c_str ());
291254 if (ImGui::IsItemHovered ()) ImGui::SetTooltip (" %s" ,tempFilename.getAbsolutePath ().c_str ());
292255 }
293- ImGui::Spacing ();
294- ImGui::Text (" %s" ,lastExternalsFolder.c_str ());
295256
296257 ImGui::Spacing ();
297258 ImGui::Spacing ();
@@ -306,10 +267,6 @@ void PDPatch::drawObjectNodeConfig(){
306267 if (ImGui::Button (" Open" ,ImVec2 (224 *scaleFactor,26 *scaleFactor))){
307268 loadPatchFlag = true ;
308269 }
309- ImGui::Spacing ();
310- if (ImGui::Button (" Set Externals Path" ,ImVec2 (224 *scaleFactor,26 *scaleFactor))){
311- setExternalFlag = true ;
312- }
313270
314271 ImGuiEx::ObjectInfo (
315272 " Pure Data ( Pd-Vanilla ) patch container with inlets and outlets. As for live coding, with this object you can live patching, passing in real time and in both directions audio and data cables." ,
@@ -327,10 +284,6 @@ void PDPatch::drawObjectNodeConfig(){
327284 patchLoaded = true ;
328285 }
329286
330- if (ImGuiEx::getFileDialog (fileDialog, setExternalFlag, " Select your PD external folder" , imgui_addons::ImGuiFileBrowser::DialogMode::SELECT, " " , " " , scaleFactor)){
331- lastExternalsFolder = fileDialog.selected_path ;
332- externalPathSaved = true ;
333- }
334287}
335288
336289// --------------------------------------------------------------
@@ -422,30 +375,6 @@ void PDPatch::loadAudioSettings(){
422375 bufferSize = XML.getValue (" buffer_size" ,0 );
423376 XML.popTag ();
424377 }
425- int totalObjects = XML.getNumTags (" object" );
426-
427- // Load object outlet config
428- for (int i=0 ;i<totalObjects;i++){
429- if (XML.pushTag (" object" , i)){
430- if (XML.getValue (" id" , -1 ) == this ->nId ){
431- if (XML.pushTag (" vars" )){
432- int totalVars = XML.getNumTags (" var" );
433-
434- for (int t=0 ;t<totalVars;t++){
435- if (XML.pushTag (" var" ,t)){
436- prevExternalsFolder = XML.getValue (" name" ," " );
437- lastExternalsFolder = prevExternalsFolder;
438- ofLog (OF_LOG_NOTICE," Externals folder: %s" ,lastExternalsFolder.c_str ());
439- XML.popTag ();
440- }
441- }
442-
443- XML.popTag ();
444- }
445- }
446- XML.popTag ();
447- }
448- }
449378 }
450379
451380 lastInputBuffer.allocate (bufferSize,4 );
@@ -461,14 +390,6 @@ void PDPatch::loadAudioSettings(){
461390 lastOutputBuffer4.allocate (bufferSize,1 );
462391
463392 pd.init (4 ,4 ,sampleRate,bufferSize/ofxPd::blockSize (),false );
464- // load externals
465- #if defined(TARGET_LINUX) || defined(TARGET_OSX)
466- if (lastExternalsFolder != " SET PD EXTERNAL FOLDER!" ){
467- cyclone_setup ();
468- zexy_setup ();
469- }
470- #endif
471-
472393
473394 pd.subscribe (" toMosaic" );
474395
@@ -505,13 +426,6 @@ void PDPatch::loadPatch(string scriptFile){
505426
506427 currentPatchFile.open (filepath);
507428
508- if (prevExternalsFolder != " " && prevExternalsFolder != " /path_to_pd_externals" ){
509- ofFile tempfile (prevExternalsFolder);
510- if (tempfile.exists () && tempfile.isDirectory ()){
511- pd.addToSearchPath (tempfile.getAbsolutePath ());
512- }
513- }
514-
515429 currentPatch = pd.openPatch (currentPatchFile.getAbsolutePath ());
516430
517431 pd.addToSearchPath (currentPatchFile.getEnclosingDirectory ());
0 commit comments