How do I use an array attribute in houdini expression or python

   4536   2   0
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
I have a detail integer array attribute on a VEX wrangle node and now I want to drive some SOP loops with that. (For each element in the array I want to do something the amount of times the value of the loop). I also made the lenght of the array a detail attribute, so I was able to drive a For loop with that.
How can I get the values of each array element?
(I am very familiar with the detail(“../node”,“iteraition”,0) and the meta node bit).


I expected it would be something like: detail(“../myVexNode”,“my_array”,detail(“../metaEachStorey”,“iteration”,0)).
But that doesnt seem to work.

Thanks in advance!
Edited by DASD - Nov. 20, 2016 16:37:33
User Avatar
Member
471 posts
Joined: Nov. 2013
Offline
Greetings.
In expression function you should use something like:
detail(“address of your node”, “attribute name”, index of your attribute)
For instance if you want third element of an array you should write:
detail(“../node”,“iteraition”,2)
Relative module in python returns an of requested attribute and you can get each index of it with a pair of brackets afterwards.
Edited by Nima - Nov. 21, 2016 01:32:22
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
Thanks, but strangely that ( detail(“../fibonacciWrangle”,“fibb”,detail(“../metaEachStorey”,“iteration”,0)) ) doesn't seem to work. Well, I worked around it with a vops node.

I'm on build 15.5.651. Maybe somebody else can check if it works for them.
  • Quick Links