@@ -150,9 +150,7 @@ Blackprint.Engine.Port = class Port extends Blackprint.Engine.CustomEvent{
150
150
// This port must use values from connected output
151
151
if ( port . source === 'input' ) {
152
152
if ( port . _cache !== void 0 ) return port . _cache ;
153
-
154
- if ( port . cables . length === 0 )
155
- return port . default ;
153
+ if ( port . cables . length === 0 ) return port . default ;
156
154
157
155
let portIface = port . iface ;
158
156
@@ -190,22 +188,17 @@ Blackprint.Engine.Port = class Port extends Blackprint.Engine.CustomEvent{
190
188
cable . visualizeFlow ( ) ;
191
189
192
190
portIface . _requesting = false ;
193
- if ( port . feature === BP_Port . ArrayOf ) {
194
- port . _cache = [ ] ;
195
- if ( output . value != null )
196
- port . _cache . push ( output . value ) ;
197
-
198
- return port . _cache ;
199
- }
191
+ if ( port . feature === BP_Port . ArrayOf )
192
+ return port . _cache = [ output . value ?? output . default ] ;
200
193
201
- return port . _cache = output . value ?? port . default ;
194
+ return port . _cache = output . value ?? port . default ?? output . default ;
202
195
}
203
196
204
197
let isNotArrayPort = port . feature !== BP_Port . ArrayOf ;
205
198
206
199
// Return multiple data as an array
207
200
var cables = port . cables ;
208
- var data = [ ] ;
201
+ var data = new Array ( cables . length ) ;
209
202
for ( var i = 0 ; i < cables . length ; i ++ ) {
210
203
var cable = cables [ i ] ;
211
204
if ( cable . connected === false || cable . disabled )
@@ -229,12 +222,13 @@ Blackprint.Engine.Port = class Port extends Blackprint.Engine.CustomEvent{
229
222
if ( Blackprint . settings . visualizeFlow )
230
223
cable . visualizeFlow ( ) ;
231
224
225
+ let gotData = output . value ?? port . default ?? output . default ;
232
226
if ( isNotArrayPort ) {
233
227
portIface . _requesting = false ;
234
- return port . _cache = output . value ?? port . default ;
228
+ return port . _cache = gotData ;
235
229
}
236
230
237
- data . push ( output . value ) ;
231
+ data [ i ] = gotData ;
238
232
}
239
233
240
234
portIface . _requesting = false ;
@@ -246,7 +240,7 @@ Blackprint.Engine.Port = class Port extends Blackprint.Engine.CustomEvent{
246
240
return port . __call ??= ( ) => port . _callAll ( ) ;
247
241
248
242
// else type: output port, let's just return the value
249
- return port . value ;
243
+ return port . value ?? port . default ;
250
244
}
251
245
} ;
252
246
0 commit comments