VEX: create attribute from groups

   672   2   1
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
Hello everybody

I want to create as many attributes (float) as groups I have, and that have the same name of the group, procedurally.

something like this:

string groups[] = detailintrinsic(0, 'primitivegroups');
foreach (string g; groups) {
if (inprimgroup(0,g,@primnum)==1) {
f@`g` = 1.0;
}
}

but it does not work.

Thanks in advance
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
4516 posts
Joined: 2月 2012
Offline
Hi,

You can do it like this using a Primitive Wrangle:

string groups [ ] = detailintrinsic ( 0, "primitivegroups" );
foreach ( string group; groups )
    if ( inprimgroup ( 0, group, @primnum ) )
        setprimattrib ( 0, group, @primnum, 1.0 );
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 | animatrix2k7.gumroad.com
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
Thanks!
Gerardo Castellanos
www.gerardocastellanos.com
  • Quick Links