Jump to content

How Do I Access An Element/component/index Of An Attribute Array


Recommended Posts

Okay so I have a point attribute HAIR_LEN_TEX[3] and I want to delete a point that has $HAIR_LEN_TEX[0]=0 but how do I access the first index/component of the attribute i.e. the [0] part in the Delete SOP? For attributes that are of lenght one I can do it fine like $HAIR_LEN=0 in the number filter expression.

Thanks.

Link to comment
Share on other sites

point("../some_sop", $PT, "HAIR_LEN_TEX", 0) == 0

Yeah I was thinking about doing it this way but you have to have some "../some_sop" and if you rename that sop then it breaks but I just noticed Houdini automatically adjusts point() if that happens so I'm a dumbass.

Thanks.

Link to comment
Share on other sites

Yeah I was thinking about doing it this way but you have to have some "../some_sop" and if you rename that sop then it breaks but I just noticed Houdini automatically adjusts point() if that happens so I'm a dumbass.

Thanks.

A really great tip is to get in to the habit of using the following syntax to grab the attribute from the SOP feeding into the current one. Then you can rewire, insert another SOP above it, rename, etc and it all still works. I use this syntax all the time.

point("../"+opinput(".",0), $PT, "HAIR_LEN_TEX", 0) == 0

where opinput(".",0) means get the name of the SOP that is the first input (i.e. input number 0) into the current SOP (which can be referred to in shorthand as ".").

This tip is in the new Houdini on the Spot book I believe.

john

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...