Creating texture path with VEX

   2510   3   1
User Avatar
Member
31 posts
Joined: June 2016
Offline
Hi

I have a shader prim that I would like to add a texture to via vex. With usd_setattrib(0, @primpath, "inputs:tex0", "texturepath") I am successfull to change the attribute, however Redshift doesn't like it. On comparision between a value set with a material node I can see that the texture path is encapsulated by @ -> @texturepath@.

The reason is that inputs:tex0 is a usd input, rather than a string I suppose. However when the attribute is created with a material node (so that the input is set up correctly) then using the same line works.

So is there a way to create the attribute as an usd_input. I tried with python a bit but ... that pixar documentation beats me down every time.
User Avatar
Member
31 posts
Joined: June 2016
Offline
I guess I figured out the problem:
@ signals an asset type in USD, but usd_setattrib() converts the attribute to a String when a string is given ("texturepath" in my case).

So new question: is there a way in vex I can supply an Sdf.ValueTypeName.Asset?
User Avatar
Staff
1449 posts
Joined: July 2005
Offline
You can call `usd_addattrib()` with the desired type ("asset"), first. Then set it.
https://www.sidefx.com/docs/houdini/vex/functions/usd_addattrib.html [www.sidefx.com]
User Avatar
Member
31 posts
Joined: June 2016
Offline
Cool, that works yes. I was afraid something fishy would happen if I try to add an attribute that already exists - but an easy way around that is to check first.
Ta!
  • Quick Links