Iterate through MPC in custom shader node

Hey, I need an Array of floats in my shader and one of vectors. Only way i found to do this is through Material Parameter Collection.

I have a MPC of VectorParameters and try to loop through it in a custom node with a simple for loop, only I’m unable to find the correct syntax to index the collection.

Since the .h file for a MPC says:


UPROPERTY(EditAnywhere, Category=Material, Meta = (TitleProperty = "ParameterName"))
TArray<FCollectionScalarParameter> ScalarParameters;

UPROPERTY(EditAnywhere, Category=Material, Meta = (TitleProperty = "ParameterName"))
TArray<FCollectionVectorParameter> VectorParameters;

you would think this, in my custom node, should work:


for(int i=0; i<PosParamAmount; i++)
{
return PositionParams.VectorParameters*;
}

but it trows the following error:


[SM5] /Engine/Generated/Material.ush(1863,9-39): error X3018: invalid subscript 'VectorParameters'
[SM5] /Engine/Generated/Material.ush(1863:24): error: invalid format for vector swizzle 'VectorParameters'
return PositionParams.VectorParameters*;
^


Just curious on this, mostly.
the data for a MPC node usually has to be individualized - you have to select the single entry to use.
So, what are you feeding into the custom node?

also, what kind of data are you working with?
now that I went and did it for the landscape, i would suggest that maybe a custom texture with packed data is more efficient if you read it off pixel by pixel kinda like the pivot painter thing does…
if you make an image of 100x100 pixel you can use .01 as the uv to sort them out and use their individual values.
Looping through that may be easier.

I’m doing a PPFX for RTS game, each building holds a few positions to draw a line to and a circle at the position. a building can have multiple of these area’s.
I made it before in Unity, where i could just use an array in the shader and add positions and radius to the arrays.
The closest thing i found was MPC and this post, so Thats the first I’m trying.
Since I’m learning UE4 I would like to have an answers as to** why i can’t access the 2 UProperties ScalarParameters and VectorParameters in UMaterialParameterCollection.h inside a custom node?**