trying to hand an array of floats from one attribute wrangle to another.

   1845   4   2
User Avatar
Member
13 posts
Joined: Nov. 2013
Offline
Hi,
I've assigned a bunch of floats to an array in a attribute wrangle which I want to read later on in another attribute wrangle.

first wrangle:
f@length_array = array(1,2,3,4,5);

and then in the later wrangle i do this:

printf(“my array %f”, @length_array);

it just prints out “my array 0.000000”. Am I right in thinking that its not global between attribute wrangles, or is there something i'm missing?

thank jean-marc. p.s currently using houdini apprentice 17.
User Avatar
Member
12 posts
Joined: May 2017
Offline
Hi Jean-Marc,
You need to use f[]@ to create and access array attributes so:
first wrangle:
f[]@length_array = array(1,2,3,4,5);
Next wrangle:
printf(my array %f, f[]@length_array);

More useful info on using vex here: http://www.sidefx.com/docs/houdini/vex/snippets.html#arrays [www.sidefx.com]
Edited by Leaf - Feb. 26, 2019 19:36:10
User Avatar
Member
9380 posts
Joined: July 2007
Offline
just for completeness, since [] are not automatically shown in the forum even though Leaf probably wrote them in there
first wrangle shoud be:
f[]@length_array = array(1,2,3,4,5);
second wrangle:
printf(my array %g, f[]@length_array);
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
12 posts
Joined: May 2017
Offline
Ah, thanks for pointing that out tamte, my original reply looked really confusing!
Edited my original post so it makes sense haha.
User Avatar
Member
13 posts
Joined: Nov. 2013
Offline
thanks , that works a treat.
Edited by jean_marc - Feb. 27, 2019 14:45:55
  • Quick Links