@@ -331,12 +331,12 @@ Object.assign(NodeMaterial.prototype, {
331
331
if ( inOrOutAndTypeAndName [ 0 ] === "out" ) {
332
332
this . addOutput ( inOrOutAndTypeAndName [ 1 ] , inOrOutAndTypeAndName [ 2 ] ) ;
333
333
// this.defineOuputGetter(this.outputName[this.outputName.length - 1], this.outputName.length - 1);
334
- }
335
- if ( inOrOutAndTypeAndName [ 0 ] === "in" ) {
334
+ } else if ( inOrOutAndTypeAndName [ 0 ] === "in" ) {
336
335
this . addInput ( inOrOutAndTypeAndName [ 1 ] , inOrOutAndTypeAndName [ 2 ] ) ;
337
336
// this.defineInputSetter(this.inputName[this.inputName.length - 1], this.inputName.length - 1);
338
337
} else {
339
338
// unsupported parameter !!! TODO add support for more parameter types?
339
+ console . warn ( 'unsupported parameter in shader function!!!' ) ;
340
340
}
341
341
}
342
342
} ,
@@ -347,10 +347,21 @@ Object.assign(NodeMaterial.prototype, {
347
347
return ret ;
348
348
} ,
349
349
350
- connect : function ( srcIndex , srcPortName , dstIndex , dstPortName ) {
351
- var connection = { srcIndex : srcIndex , srcPortName : srcPortName , dstIndex : dstIndex , dstPortName : dstPortName } ;
352
-
353
- this . graphData . connections . push ( connection ) ;
350
+ connect : function ( srcIndex , srcPortName , dstIndex , dstPortName , conIndex ) {
351
+ if ( conIndex != undefined )
352
+ {
353
+ this . graphData . connections [ conIndex ] . srcIndex = srcIndex ;
354
+ this . graphData . connections [ conIndex ] . srcPortName = srcPortName ;
355
+ this . graphData . connections [ conIndex ] . dstIndex = dstIndex ;
356
+ this . graphData . connections [ conIndex ] . dstPortName = dstPortName ;
357
+ }
358
+ else
359
+ {
360
+ var connection = { srcIndex : srcIndex , srcPortName : srcPortName , dstIndex : dstIndex , dstPortName : dstPortName } ;
361
+ conIndex = this . graphData . connections . length ;
362
+ this . graphData . connections . push ( connection ) ;
363
+ }
364
+ return conIndex ;
354
365
} ,
355
366
356
367
_getIoPortValueString : function ( ioPort ) {
@@ -678,7 +689,7 @@ Object.assign(NodeMaterial.prototype, {
678
689
// it should not be possible for the the number of iterations to exceeds the number of connections - unless there is a cyclic dependency
679
690
var whileLoopCount = 0 ;
680
691
681
- while ( subGraphList . length < this . graphData . subGraphs . length || whileLoopCount < this . graphData . connections . length ) {
692
+ while ( subGraphList . length < this . graphData . subGraphs . length && whileLoopCount < this . graphData . connections . length ) {
682
693
whileLoopCount ++ ;
683
694
684
695
for ( i = 0 ; i < this . graphData . subGraphs . length ; i ++ ) {
@@ -767,7 +778,7 @@ Object.assign(NodeMaterial.prototype, {
767
778
} ) ;
768
779
769
780
var shadergraph = { } ;
770
-
781
+ /*
771
782
shadergraph.graphCounter = 0;
772
783
773
784
shadergraph.nodeRegistry = {};
@@ -872,5 +883,5 @@ shadergraph.connectCustom = function (destNodeIndex, destName, nodeIndex_or_para
872
883
this.graph.connect(-1, ioPort.name, destNodeIndex, 'IN_' + destName);
873
884
}
874
885
};
875
-
886
+ */
876
887
export { NodeMaterial , shadergraph } ;
0 commit comments