Skip to content

Commit 28a47e7

Browse files
committed
proper cleaning editing files on removing shader
1 parent 21e72cf commit 28a47e7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/ofxVisualProgramming.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,12 +878,28 @@ void ofxVisualProgramming::clearObjectsMap(){
878878
// remove scripts objects filepath reference from scripts objects files map
879879
ofFile tempsofp(patchObjects.at(eraseIndexes.at(x))->getFilepath());
880880
string fileExt = ofToUpper(tempsofp.getExtension());
881-
if(fileExt == "LUA" || fileExt == "PY" || fileExt == "SH" || fileExt == "FRAG"){
881+
if(fileExt == "LUA" || fileExt == "PY" || fileExt == "SH"){
882882
map<string,string>::iterator sofpIT = scriptsObjectsFilesPaths.find(tempsofp.getFileName());
883883
if (sofpIT != scriptsObjectsFilesPaths.end()){
884884
// found it, remove it
885885
scriptsObjectsFilesPaths.erase(sofpIT);
886886
}
887+
}else if(fileExt == "FRAG"){
888+
// remove .frag
889+
map<string,string>::iterator sofpIT = scriptsObjectsFilesPaths.find(tempsofp.getFileName());
890+
if (sofpIT != scriptsObjectsFilesPaths.end()){
891+
// found it, remove it
892+
scriptsObjectsFilesPaths.erase(sofpIT);
893+
}
894+
// remove .vert
895+
string pf_fsName = tempsofp.getFileName();
896+
string pf_vsName = tempsofp.getEnclosingDirectory()+tempsofp.getFileName().substr(0,pf_fsName.find_last_of('.'))+".vert";
897+
ofFile tempVert(pf_vsName);
898+
map<string,string>::iterator sofpITV = scriptsObjectsFilesPaths.find(tempVert.getFileName());
899+
if (sofpITV != scriptsObjectsFilesPaths.end()){
900+
// found it, remove it
901+
scriptsObjectsFilesPaths.erase(sofpITV);
902+
}
887903
}
888904

889905
patchObjects.at(eraseIndexes.at(x))->removeObjectContent(true);

0 commit comments

Comments
 (0)