@@ -91,31 +91,32 @@ Object.assign(ShaderGraphNode.prototype, {
91
91
var i ;
92
92
if ( this . graphData . ioPorts && this . graphData . ioPorts . length > 0 && ( this . graphData . customFuncGlsl || ( this . graphData . subGraphs && this . graphData . subGraphs . length > 0 && this . graphData . connections ) ) ) {
93
93
for ( i = 0 ; i < this . graphData . ioPorts . length ; i ++ ) {
94
- if ( this . graphData . ioPorts [ i ] && this . graphData . ioPorts [ i ] . name && this . graphData . ioPorts [ i ] . type ) {
95
- if ( this . graphData . ioPorts [ i ] . type === 'sampler2D' && ! this . graphData . ioPorts [ i ] . name . startsWith ( 'OUT_' ) ) {
96
- if ( ! ( this . graphData . ioPorts [ i ] . valueTex && this . graphData . ioPorts [ i ] . valueTex instanceof Texture ) ) {
94
+ var ioPort = this . graphData . ioPorts [ i ] ;
95
+ if ( ioPort && ioPort . name && ioPort . type ) {
96
+ if ( ioPort . type === 'sampler2D' && ! ioPort . name . startsWith ( 'OUT_' ) ) {
97
+ if ( ! ( ioPort . valueTex && ioPort . valueTex instanceof Texture ) ) {
97
98
return false ;
98
99
}
99
- } else if ( this . graphData . ioPorts [ i ] . type === 'float' && ! this . graphData . ioPorts [ i ] . name . startsWith ( 'OUT_' ) ) {
100
- if ( ! ( this . graphData . ioPorts [ i ] . valueX != undefined && typeof ( this . graphData . ioPorts [ i ] . valueX ) === 'number' ) ) {
100
+ } else if ( ioPort . type === 'float' && ! ioPort . name . startsWith ( 'OUT_' ) ) {
101
+ if ( ! ( ioPort . valueX != undefined && typeof ( ioPort . valueX ) === 'number' ) ) {
101
102
return false ;
102
103
}
103
- } else if ( this . graphData . ioPorts [ i ] . type === 'vec2' && ! this . graphData . ioPorts [ i ] . name . startsWith ( 'OUT_' ) ) {
104
- if ( ! ( this . graphData . ioPorts [ i ] . valueX != undefined && typeof ( this . graphData . ioPorts [ i ] . valueX ) === 'number' &&
105
- this . graphData . ioPorts [ i ] . valueY != undefined && typeof ( this . graphData . ioPorts [ i ] . valueY ) === 'number' ) ) {
104
+ } else if ( ioPort . type === 'vec2' && ! ioPort . name . startsWith ( 'OUT_' ) ) {
105
+ if ( ! ( ioPort . valueX != undefined && typeof ( ioPort . valueX ) === 'number' &&
106
+ ioPort . valueY != undefined && typeof ( ioPort . valueY ) === 'number' ) ) {
106
107
return false ;
107
108
}
108
- } else if ( this . graphData . ioPorts [ i ] . type === 'vec3' && ! this . graphData . ioPorts [ i ] . name . startsWith ( 'OUT_' ) ) {
109
- if ( ! ( this . graphData . ioPorts [ i ] . valueX != undefined && typeof ( this . graphData . ioPorts [ i ] . valueX ) === 'number' &&
110
- this . graphData . ioPorts [ i ] . valueY != undefined && typeof ( this . graphData . ioPorts [ i ] . valueY ) === 'number' &&
111
- this . graphData . ioPorts [ i ] . valueZ != undefined && typeof ( this . graphData . ioPorts [ i ] . valueZ ) === 'number' ) ) {
109
+ } else if ( ioPort . type === 'vec3' && ! ioPort . name . startsWith ( 'OUT_' ) ) {
110
+ if ( ! ( ioPort . valueX != undefined && typeof ( ioPort . valueX ) === 'number' &&
111
+ ioPort . valueY != undefined && typeof ( ioPort . valueY ) === 'number' &&
112
+ ioPort . valueZ != undefined && typeof ( ioPort . valueZ ) === 'number' ) ) {
112
113
return false ;
113
114
}
114
- } else if ( this . graphData . ioPorts [ i ] . type === 'vec4' && ! this . graphData . ioPorts [ i ] . name . startsWith ( 'OUT_' ) ) {
115
- if ( ! ( this . graphData . ioPorts [ i ] . valueX != undefined && typeof ( this . graphData . ioPorts [ i ] . valueX ) === 'number' &&
116
- this . graphData . ioPorts [ i ] . valueY != undefined && typeof ( this . graphData . ioPorts [ i ] . valueY ) === 'number' &&
117
- this . graphData . ioPorts [ i ] . valueZ != undefined && typeof ( this . graphData . ioPorts [ i ] . valueZ ) === 'number' &&
118
- this . graphData . ioPorts [ i ] . valueW != undefined && typeof ( this . graphData . ioPorts [ i ] . valueW ) === 'number' ) ) {
115
+ } else if ( ioPort . type === 'vec4' && ! ioPort . name . startsWith ( 'OUT_' ) ) {
116
+ if ( ! ( ioPort . valueX != undefined && typeof ( ioPort . valueX ) === 'number' &&
117
+ ioPort . valueY != undefined && typeof ( ioPort . valueY ) === 'number' &&
118
+ ioPort . valueZ != undefined && typeof ( ioPort . valueZ ) === 'number' &&
119
+ ioPort . valueW != undefined && typeof ( ioPort . valueW ) === 'number' ) ) {
119
120
return false ;
120
121
}
121
122
}
0 commit comments