Creating material assets? Use this expression.

   6712   4   2
User Avatar
Member
237 posts
Joined: 4月 2011
オフライン
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
7046 posts
Joined: 7月 2005
オフライン
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
Cheers,

Peter Bowmar
____________
Houdini 20.5.262 Win 10 Py 3.11
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
オフライン
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
7046 posts
Joined: 7月 2005
オフライン
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
Cheers,

Peter Bowmar
____________
Houdini 20.5.262 Win 10 Py 3.11
User Avatar
Member
268 posts
Joined: 7月 2005
オフライン
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