Jump to content

How to handle importing any type of attribute at the asset level?


Recommended Posts

Hi,

I am making a digital asset that allows users to specify the attribute name they want to use for the operation. I have a VOPSOP inside, with an Inline VOP, that uses the import VEX function:

vector v;
import($attribute, v, 0);

But since I have to specify the type of the attribute being imported, do I have to have a different version for each type?

Is there a way to query the type of an attribute? Or do I have to create a menu parameter at the asset level that requires the user to specify the type?

I don't know which SOPs do this, but I found that Smooth SOP allows you to use any attribute without specifying the type. So then there is a slick way to do this, right?

Thanks :)

Link to comment
Share on other sites

The way python and vex view attributes in Houdini is a bit different so there's no one function that will tell you which vex type your attribute is. Usually I use hou.attrib.dataType(), first to identify strings and integers, then if hou.attrib.dataType() is a float I use hou.attrib.size() to check if the float is really a vector or a matrix.

  • Like 1
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...