VL sandboxing ConnectAll from node13

hello VorLd
trying to understand the new concepts
chose ConnectAll from the node13 plugin workshop as target

attached is what i think could be a way to get it to function
still its all forced connections for now

main points:

  • is the “for each” approach right for this situation ?
  • is there a need for extra fields in the main patch if it should reset every frame ?
  • what is missing after the points inlet, making all connections red ?

any counselling appreciated. thanks

VL - ConnectAllTryout.zip (17.3 kB)

ups, forgot to update i think

VL - ConnectAllTryout01.zip (17.2 kB)

hey ggml,

i had a try at it.
i somehow needed two nested loops like in the c# example.

the left example builds nested spreads at first. since this deep nesting is not needed at the end, they need to be flattened, and since not every slice is needed they also get filtered afterwards. this is a bit time consuming.

the right example shows how to use spread builders. the spread builders are empty at the beginnning (nothing connected to the accumulator inputs at outer loop).

from there on all spread builders get routed through all permutations of all points.
since we route those spread builders manually through all slices we need no flattening afterwards. no deep structures get created like seen in the left example.

and: we only add something when needed. so no filtering needed afterwards.

so the right one is faster, but they both do the same thing…

VL - ConnectAll - Different Ways.zip (87.3 kB)

here is also some general advice after looking at your original patch:

  • take care of types: as opposed to vvvv Spread is something different than Vector2. the Distance node can only work with Vector2 not with spreads, as you tried to connect it. the Concat node can only concat spreads, not a Spread and a Vector2 as you tried it.
  • you can imagine input/output pins on loops as something which changes the ‘dimension’ of a type. if you input a Sequence or a Spread you get a Vector2 inside of the loop. so that part was right in your patch. but if you output a Spread you will get a Spread<Spread> as the output of the loop. if you want to keep the dimension of the type use an accumulator, see A, B and Distance in gregsns ConnectAllFast patch.
  • the Create method will not be called every frame, as your comment suggests, it will only be called one time, when the node is created or reset.
  • state: since the ConnectAll algorithm does not need to access data from the past, but only gets some data per frame, finds the connections in it and returns the result, it does not need to store data in fields. this means that you can create the spreads each frame on the fly instead of storing them in fields and resetting them each frame.

thank you for the examples and for the advices
so an empty field inside a region (“index” here) is returning the iteration number.
is this right ?
if so, is there a node that i can connect to the field and get the number of iterations it is doing in that specific region ? or doesn’t it know what is going on ?

to get the index in a loop, you can create any pad (constant, accumulator, input) and then rightclick on it and select replace → “iteration”. so the simplest would be double right click to create a constant and then replace as iteration.

the iteration count of a For Loop is the one which you put in at the Count input pin. you can link the same value into the loop to work with it.

the foreach loop takes the minimum count of all collections connected to input pins. so in a simple case with only one input you can take the count of the spread or sequence which you put in and link that into the loop region.

but it would be a good idea to provide the actual count as a filed similar to the index.

ah, and advice no 5:

the naming convention in VL uses PascalCasing, so always start with an uppercase letter, see: https://thegraybook.vvvv.org/reference/language/namings.html

here is a fixed version of gregsns upload to work with b35.

VL - ConnectAll - Different Ways.zip (133.0 KB)