Vex help

   1149   2   0
User Avatar
Member
8 posts
Joined: 1月 2018
Offline
Need a little help unraveling what I'm interpreting wrong as far as what setattrib() is asking for in a VEXpression. I thought I needed to give it the primitive number my attribute wrangle is running through, and the vertex i'm currently on, but @primnum only seems to return the 0 primitive, as can be seen.

Attachments:
Capture.PNG (80.1 KB)

User Avatar
Member
4537 posts
Joined: 2月 2012
Offline
Hi,

You can just use this and pass @vtxnum to prim_num and -1 to vertex_num:
https://www.sidefx.com/docs/houdini/vex/functions/setvertexattrib.html [www.sidefx.com]

setvertexattrib(0, "Cd", @vtxnum, -1, set(0, 1, 1));
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
480 posts
Joined: 7月 2005
Offline
Hi,

Substitute @primnum with -1, just because @vtxnum is not primitive relative (it is a global value “linear vertex index”).

You can also use “setvertexattrib” directly (to avoid attribclass), or just write @Cd = set(1,0,0);.
  • Quick Links