How do I save a texture from a opdef:/Object path to my local filesystem?

   6128   4   1
User Avatar
Member
9 posts
Joined: 6月 2016
Offline
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?

Edited by CreateTheImaginable - 2016年8月11日 00:58:34
User Avatar
Member
2573 posts
Joined: 6月 2008
Offline
Just render it, top down with the camera aspect ratio matching the XY grid size.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
1914 posts
Joined: 11月 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

>>> 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
User Avatar
スタッフ
3456 posts
Joined: 7月 2005
Offline
or just save it to file through the Type Properties…
1 - select the section (that's what these things are called)
2 - save as file

Attachments:
saveAsFile.jpg (95.0 KB)

Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
9 posts
Joined: 6月 2016
Offline
Thanks to all 3 of you for your solutions! I am going to try all 3 just to learn more about Houdini!
  • Quick Links