How do I save a texture from a opdef: /Object path to my local filesystem?
I am able to add opdef: /Object/simplefemale?color.flattened.1001.jpg to a Grid object using uvflatten by using a shader that uses that image mapped to it.
But how do I save that texture jpg to a file on my local file system?
How do I save a texture from a opdef:/Object path to my local filesystem?
6129 4 1- CreateTheImaginable
- Member
- 9 posts
- Joined: 6月 2016
- Offline
- Enivob
- Member
- 2573 posts
- Joined: 6月 2008
- Offline
- graham
- Member
- 1914 posts
- Joined: 11月 2006
- Online
It's possible to extract the internal file's contents using HOM and write it out to wherever you'd like. There are two different ways to access the files:
Query the asset definition for the “section” (everything inside an asset is stored in named thing called a section) and just get the contents and write it back out
The hou.readFile() function can also understand opdef: references so you can do that as well.
Query the asset definition for the “section” (everything inside an asset is stored in named thing called a section) and just get the contents and write it back out
>>> s = hou.node('/obj/simplefemale1').type().definition().sections()["color.flattened.1001.jpg"] >>> with open("/tmp/color.flattened.1001.jpg", "w") as fp: ... fp.write(s.contents())
The hou.readFile() function can also understand opdef: references so you can do that as well.
>>> with open("/tmp/color.flattened.1001.jpg", "w") as fp: ... fp.write(hou.readFile("opdef:/Object/simplefemale?color.flattened.1001.jpg"))
Graham Thompson, Technical Artist @ Rockstar Games
- goldfarb
- スタッフ
- 3456 posts
- Joined: 7月 2005
- Offline
- CreateTheImaginable
- Member
- 9 posts
- Joined: 6月 2016
- Offline
-
- Quick Links