if (@primnum>0) removeprim(0,@primnum,1);
Leave only the first prim in a prim group
813 3 0- element33
- Member
- 74 posts
- Joined: 1月 2015
- Offline
In a prim group, how do I remove all prims except the first one? I tried a Prim Wrangle, with the desired group in the "Group" field, like so:
But it removes all prims in a group (seems like @primnum starts at 0 for the entire geometry, not for the desired group). I can Split-SOP by group, then remove all prims but the first one, then merge back all geometry, but I'd like to do this without splitting. In a Prim Wrangle, I can also iterate through all prims, check group membership, save the first prim and remove all others, but maybe there's a way without iterating through all prims.
Edited by element33 - 2022年11月22日 19:20:01
- tamte
- Member
- 8598 posts
- Joined: 7月 2007
- Online
- element33
- Member
- 74 posts
- Joined: 1月 2015
- Offline
- animatrix_
- Member
- 4531 posts
- Joined: 2月 2012
- Offline
If you want the fastest performance though, I would recommend doing this using the Blast SOP with this expression:
If you want to do this for an arbitrary number of groups, then I would gather all the first elements into an array using a Detail Wrangle, turn this array into a space separated string and then use that with Blast SOP.
`arg(primlist(0, "myprimgroup"), 0)`
If you want to do this for an arbitrary number of groups, then I would gather all the first elements into an array using a Detail Wrangle, turn this array into a space separated string and then use that with Blast SOP.
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
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
-
- Quick Links