Read a multiparm float as a float array

   3219   3   2
User Avatar
Member
24 posts
Joined: Nov. 2019
Offline
Hello, following with the procedural vertical graph i was doing last weeks, I am now trying to do a reference in the side of the graphic that shows the relative high, so you have a reference of how much high is each block.

My aproach was creating a block that scale in the Y axis based of the max high of all the parameters of the vertical graph, the high is defined with a multiparm float, and i tough about using the vex function max() but I don't know if it is possible to create a dynamic array from multiparm block.

Thanks you for reading me.

Attachments:
multiparmscreenshot.PNG (11.4 KB)
viewport.PNG (318.6 KB)

Final Layout.
Skydance, Madrid.
https://twitter.com/RodrigoMartinKJ [twitter.com]
User Avatar
Member
8538 posts
Joined: July 2007
Offline
you can read them in a for loop
if for example your multiplarm folder is called columns and also I'd advise set first instance index to 0 instead of default 1
int ncol = chi("columns");
float alturas[];
for(int i=0; i<ncol; i++){
    string si = itoa(i);
    float altura = chf("altura" + si);
    append(alturas, altura);
}
if (ncol>0){
    f@altura_avg = avg(alturas);
    f@altura_min = min(alturas);
    f@altura_max = max(alturas);
}

Attachments:
ts_multiparm_as_array_VEX.hip (67.6 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
24 posts
Joined: Nov. 2019
Offline
tamte
you can read them in a for loop
if for example your multiplarm folder is called columns and also I'd advise set first instance index to 0 instead of default 1
int ncol = chi("columns");
float alturas[];
for(int i=0; i<ncol; i++){
    string si = itoa(i);
    float altura = chf("altura" + si);
    append(alturas, altura);
}
if (ncol>0){
    f@altura_avg = avg(alturas);
    f@altura_min = min(alturas);
    f@altura_max = max(alturas);
}
Thanks you very much! I knew loops but never though of using this way, you are the best helping everyone here in the forum! Thanks you!
Final Layout.
Skydance, Madrid.
https://twitter.com/RodrigoMartinKJ [twitter.com]
User Avatar
Member
192 posts
Joined: April 2015
Offline
RodrigoMartin
you can read them in a for loop

Would this also be possible in VOPs?

I would like to make For Loop based on a multiparm of multiple "smallerthan_thres and biggerthan_thres" couples...
but no idea how to insert an string into the Parameter VOP like you can in the chf() functions of VEX.

Attachments:
Screenshot 2021-06-25 at 13.48.41.png (651.3 KB)

  • Quick Links