612
612
window.localStorage.latest = nodesToString();
615
function makePorts(){
617
nodes.forEach(function(n){
618
n.inPoints.forEach(function(i){i.port = -1;i.el.title = "no port";});
619
n.outPoints.forEach(function(i){i.port = -1;i.el.title = "no port";});
622
nodes.forEach(function(n){
623
n.connectTo.forEach(function(c){
625
if(n.outPoints[c.outIndex].port == -1){
626
n.outPoints[c.outIndex].port = parseInt(Math.random()*9000)+1000;
627
n.outPoints[c.outIndex].el.title = n.outPoints[c.outIndex].port;
629
nodes[c.inNode].inPoints[c.inIndex].port = n.outPoints[c.outIndex].port;
630
nodes[c.inNode].inPoints[c.inIndex].el.title = n.outPoints[c.outIndex].port;
631
//inherit settings from parent
632
nodes[c.inNode].obj.parent.forEach(function(p){
634
if(s.name == p.name){
635
p.default = s.default;
636
console.log("Inherited ",s.name," with value ",p.default);
640
n.obj.fixed.forEach(inherit);
641
n.obj.settings.forEach(inherit);
642
n.obj.parent.forEach(inherit);
648
615
function getThumbnail(original) {
649
616
var canvas = document.createElement("canvas");
709
function makePorts(){
711
nodes.forEach(function(n){
712
n.inPoints.forEach(function(i){i.port = -1;i.el.title = "no port";});
713
n.outPoints.forEach(function(i){i.port = -1;i.el.title = "no port";});
716
nodes.forEach(function(n){
717
n.connectTo.forEach(function(c){
719
if(n.outPoints[c.outIndex].port == -1){
720
n.outPoints[c.outIndex].port = parseInt(Math.random()*9000)+1000;
721
n.outPoints[c.outIndex].el.title = n.outPoints[c.outIndex].port;
723
nodes[c.inNode].inPoints[c.inIndex].port = n.outPoints[c.outIndex].port;
724
nodes[c.inNode].inPoints[c.inIndex].el.title = n.outPoints[c.outIndex].port;
725
//inherit settings from parent
726
nodes[c.inNode].obj.parent.forEach(function(p){
728
if(s.name == p.name){
729
p.default = s.default;
730
console.log("Inherited ",s.name," with value ",p.default);
734
n.obj.fixed.forEach(inherit);
735
if(n.obj.settings)n.obj.settings.forEach(inherit);
736
if(n.obj.parent)n.obj.parent.forEach(inherit);
743
743
console.log("run");
745
745
//create launch string
747
747
nodes.forEach(function(n){
748
res += "/"+n.obj.name+"/";
748
res += "/"+encodeURIComponent(n.obj.name)+"/";
749
750
n.inPoints.forEach(function(i){
750
res += String(i.port) + " ";
751
tmp += String(i.port) + " ";
752
753
n.outPoints.forEach(function(i){
753
res += String(i.port) + " ";
755
n.obj.settings.forEach(function(i){
756
res += String(i.default) + " ";
758
n.obj.parent.forEach(function(i){
759
res += String(i.default) + " ";
754
tmp += String(i.port) + " ";
756
if(n.obj.settings)n.obj.settings.forEach(function(i){
757
tmp += String(i.default) + " ";
759
if(n.obj.parent)n.obj.parent.forEach(function(i){
760
tmp += String(i.default) + " ";
761
res = res.substr(0,res.length-1);
762
res += encodeURIComponent(tmp.substr(0,tmp.length-1));
763
res = "/run" + res.replace(/ /g,"_");
764
res = "/run" + res;//.replace(/ /g,"_");