Why do I have to add "@" before attribute name in Point Wrangle but not HDA

   2483   2   2
User Avatar
Member
90 posts
Joined: May 2016
Offline
Hello,

I'm wondering why is it that I have to add “@” before an attribute name (like @P) when using point wrangler but when doing a houdini digital assets?

point wrangle code:

if (@P.z > 0) {
        @P.z = 0;
        @Cd = {0,0.5,0};
        
}

HDA code:

sop
vih_flatten_example()
{
if (P.z > 0) {
        P.z = 0;
        Cd = {0,0.5,0};
        
}
}
User Avatar
Member
34 posts
Joined: Jan. 2017
Offline
I'm a newbie in Houdini and VEX code, but in Wrangle documentation seems to explain it uses @ to create temporary VEX variables.

https://www.sidefx.com/docs/houdini15.0/nodes/sop/pointwrangle [sidefx.com]
User Avatar
Member
8551 posts
Joined: July 2007
Offline
@ is a special syntax for snippets to bind to an attribute
it's not part of VEX language
you can dive into Point Wrangle, RMB on attribvop1 inside and choose VEX/VOP Options/View VEX Code… to actually see the VEX code created from your snippet

more help on snippets here https://www.sidefx.com/docs/houdini15.5/vex/snippets [sidefx.com]

if you are building your operators directly in VEX, then certain types of operators already have some Global Variables that may be bound to or return certain data like SOP type operator you mentioned, however you can't just use the same logic for custom attributes, as well I'm not sure if P or Cd or other would just work like that for CVEX operators, you would need to define them as operator function arguments
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links