CreateArray

 
 
 
Posted by:MattClemntson
Data created:16 October 2012

How does CreateArray work? I would expect it to take multiple inputs and output an array but it only seems to take one element and then a length - does that mean it creates an array of identical elements?

Yes, with a specified length. If you want to create an enumeration you can also use Series<> node, which will create an array of incrementing values.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

So, what if I wanted an array of arbitary objects (say an array of different polygon meshes) and then select one of them based on a given index?

In Lab, whichever input takes a collection of something (be it IEnumerable<>, IList<>, array, etc) can also take individual entries as input. For example, if your selector function takes an array of values and you have 3 nodes each providing a single entry into that array you can simply wire the first entry into the array input. The UI in the selector node will change to allow you to wire the next two entries into it. This is the same as if you first created an array from those three entries and then connected the array into the input.

Hope that makes sense. You can always make a script like:

float[] ToArray( float[] inputs ) {... }

but that kind of is redundant.

Marsel Khadiyev (Software Developer, EPHERE Inc.)