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?
7597 4 1-
- CreateTheImaginable
- Member
- 9 posts
- Joined: June 2016
- Offline
-
- Enivob
- Member
- 2658 posts
- Joined: June 2008
- Offline
-
- graham
- Member
- 1926 posts
- Joined: Nov. 2006
- Offline
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
- Staff
- 3465 posts
- Joined: July 2005
- Offline
-
- CreateTheImaginable
- Member
- 9 posts
- Joined: June 2016
- Offline
-
- Quick Links

