How do I retrieve a USD attribute in Hscript?

   312   0   1
User Avatar
Member
28 posts
Joined: 11月 2021
Offline
Hello Houdini community!

Today I come again with a doubt I cannot answer myself after much looking around.

As the title describes, I’m wondering how can I call an attribute in Hscript in a LOP/Solaris environment, most specifically around USD primitives.

In my case, what I’m trying to do is to rename a USD primitive(procedurally). As far as I read, in this environment, the name is stored as @primname or even I can refer back to @primpath per se, being the complete path. I tried changing any of these in VEX, using usd_setattrib(), but instead what I got was a new attribute. I understand the path per se and/or the primitive name don’t show up in the tree view of the attributes in the Geometry Spreadsheet natively, so I guess they’re not accessible to be edited in VEX.

In consequence next thought was to use some node where I could feed a new @alt_name attribute. Exploring options, I found Restructure Scene Graph, where the incoming name of primitive is stored as @name. So, my question is… how do I access that @alt_name I created. By just feeding it… it doesn't work, either as an attribute or a primvar attribute. Reading a bit more in the documentation, it suggests that these USD primitives are regarded as… good old prims, hence I though that maybe `prims()` (since it's a string) would do the charm, but it’s a bit like mixing pears with apples, since that function requires a primitive number, and these USD primitives don’t have that. They have… an ID, a path for sure, but they’re not “good old prims”.

So, in Hscript, how do I retrieve a USD attribute? 🤷🏻‍♂️
(or alternatively, how do can I change a USD name/path in VEX)

Thanks in advance and I hope you find the question of interest!
Any questions are welcomed : )
  • Quick Links