Creating material assets? Use this expression.

   6076   4   2
User Avatar
Member
237 posts
Joined: April 2011
Offline
If you want to create a material asset with an embedded image, use the following expression to source the image:

opdef:`pythonexprs(“hou.pwd().type().nameWithCategory()”)`?image.jpg

…and remember to include/embed the image file into the “extras” tab of the type properties window for your asset.

That's it!
User Avatar
Member
7025 posts
Joined: July 2005
Offline
You used to be able to do:

opdef:.?image.jpg

Does that no longer work? Python is great, except when you end up with this type of thing

Cheers,

Peter B
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
It used to work, still does. And then operator namespaces came along in H12.0 that makes this ambiguous if you are using namespaces to run two nodes with the same name/definition in the same scene:

http://www.sidefx.com/docs/houdini12.1/assets/namespaces [sidefx.com]
There's at least one school like the old school!
User Avatar
Member
7025 posts
Joined: July 2005
Offline
OK good! I presume opdef:. will return the fully qualified name of the HDA? I can't imagine a situation where you'd want anything except pulling the script from the current definition. So if you have two versions, each would have their own script that would be referred to. Anything else would result in debugging madness

Cheers,

Peter B
User Avatar
Member
268 posts
Joined: July 2005
Offline
The opdef in conjunction with images in shaders is currently experiencing issues (logged). It should work when used in other fields like file sops. The python expression is one way to get it to work; another is to use ‘optypeinfo’. Additional flag has been added to it to return fully namespaced optype name with the ‘o’ option.

opdef:`optypeinfo(“.”,“o”)`?image.jpg
  • Quick Links