Question on VEX prim function

   223   6   1
User Avatar
Member
273 posts
Joined: 7月 2013
オフライン
I have seen a setup of an Attribute Wrangle using this code:

s@myname = prim(1, "path",0);

Where a path attribute from fractured geo is input in to the second input (i.e. 1 in the Wrangle).
But what is the 0 for?
User Avatar
Member
82 posts
Joined: 4月 2013
オフライン
The primitive number.
"Genius might be the ability to say a profound thing in a simple way." — Charles Bukowski
User Avatar
Member
273 posts
Joined: 7月 2013
オフライン
What does a value of 0 signify?
User Avatar
Member
82 posts
Joined: 4月 2013
オフライン
The number of the primitive to read the attribute from.
"Genius might be the ability to say a profound thing in a simple way." — Charles Bukowski
User Avatar
Member
20 posts
Joined: 6月 2023
オフライン
the prim function takes three things, the data stream, aka the input to the wrangle, the attribute (as a string) you want to read, and then the primitive you want to sample that attribute from. So in your case you are looking for the path attribute on prim 0 from the second input of your wrangle. The 0th prim, prim index 0. You could sample the second, third, 583th prim or any primnum. But the 0 means your are sampling prim 0. You can visualise the prim num next to the Velocity and point num etc on the right hand side of the viewport.

As a tip, if your type out the function without closing the brackets, "prim(" and wait a split second, you will get the documentation for VEX functions
Edited by Integral3D - 昨日 04:47:18
User Avatar
Member
273 posts
Joined: 7月 2013
オフライン
Thanks everyone. I somehow manage to find the wrong syntax listed for the function on a search, it had things in the wrong order so it didn't make sense. Thanks for confirming this.
User Avatar
Member
2169 posts
Joined: 9月 2015
オフライン
litote
Thanks everyone. I somehow manage to find the wrong syntax listed for the function on a search, it had things in the wrong order so it didn't make sense. Thanks for confirming this.


You might find the SideFX Vex Functions page usefull in the future:

https://www.sidefx.com/docs/houdini/vex/functions/index.html [www.sidefx.com]
  • Quick Links