Thank you for these cool modifications.
You are right.
search didn't work because of extra whitespaces .
LGraphCanvas.prototype.renderInfo = function (ctx, x, y)
LGraphCanvas.prototype.renderInfo = function( ctx, x, y )
Now I find it. :)
I usually prefer to have different versions of same node, But I gave it a try.
I added your modification as you showed, but couldn't see any difference.("save as" window pops up with empty name field)
Anyways, I change your code a bit.
Now if you press the save button and alt key , it saves on existing node file without confirmation.
otherwise works like before.
code:
Editor.prototype.onSaveButton = function (e)
{
if (this.graph.blocked) return;
var saveFilePath="";
// var saveFilePath = moi.filesystem.getSaveFileName( lang.getTranslation('Save as')+' ..', lang.getTranslation('MoI Nodeeditor files')+' (*.nod)|*.nod' );
// if (e.altKey) {saveFilePath = moi.filesystem.getSaveFileName(lang.getTranslation('Save as') + '..', lang.getTranslation('MoI Nodeeditor files') + ' (*.nod)|*.nod',lang.getTranslation(this.graph.filename));}
if (e.altKey) {saveFilePath = lang.getTranslation(this.graph.filename);}
else {saveFilePath = moi.filesystem.getSaveFileName( lang.getTranslation('Save as')+' ..', lang.getTranslation('MoI Nodeeditor files')+' (*.nod)|*.nod' );}
if ( !saveFilePath ) return false;
if ( this.graph.status !== LGraph.STATUS_STOPPED ) this.onPlayButton();
var file = moi.filesystem.openFileStream( saveFilePath, 'w' );
file.writeLine(LiteGraph.JSONprettify(this.graph.serialize(), {"indent":" ", 'maxLength':150}));
file.close();
this.graph.filename = saveFilePath;
this.graph.setDirtyCanvas(true,true);
}
|