Spread of spreads

Again about plugins, how can be set a spread of spreads as output pin value ?

ISpread<ISpread<double>> FFooOut;


so i have something like this :

ISpread<ISpread> FPositionsSpread;

is that right to fill values like this then :

FPositionsSpreadspreadIndexvectorIndex = new Vector3D(a,b,c);

i get a crash everytime i try to do that into a foreach loop, is that way wrong or should I better search somewhere else ? maybe the slicecount ?

thank u ;)

a spread of spread needs to be built in a slightly different manner than a simple spread.

marking a field with

ISpread<Vector3D> FFoo;

means that vvvv will take care of creating that spread and you will only need to adjust the Slicecount and set the values.
Vector3D however is a good example: you need to create those vector values. The slices need to be created, while the spread itself is already there.
In this simple case the type of the slices is Vector3D. So you need to create one of those:

FFoo[i](i) = new Vector3D(a,b,c);

Now if you have a spread of spreads the slices of the outer spread hold values of type ISpread. You still need to create the values for the slices, only this time you need to create values of type ISpread…

And to achieve that there are several ways to do it:

  • You could directly create a spread of vectors and assign it as a slice of your outer spread:

    FPositionsSpreadi = new Spread();

After that set the slicecount with

FPositionsSpread[i](i).SliceCount = ...

and then put a vector into the inner spread with something like

FPositionsSpread[spreadIndex](spreadIndex)[vectorIndex](vectorIndex) = new Vector3D(a,b,c);
  • You could also create a List with

    var mytemplist = new List();

add vectors to it, and after you edited the list copy the whole thing into the output slice you want:

FPositionsSpread[i](i) = mytemplist.ToSpread();

For this to work you need to add

using System.Collections.Generic;

since the List<> is defined there.

i thougt was a slicecount prob, seems to work like this :


FPositionsSpread[userIndex](userIndex)[vectorIndex](vectorIndex) = new Vector3D(a,b,c);

but i will try also declaring the Spread, now i dont need it cos i know the sliceCount, si kinda static value :)

yes right, you need to set the slicecount of the inner spread as well, then it works…