presets in ascii (or hexpand/hcollapse for presets)

   7988   8   2
User Avatar
Member
1705 posts
Joined: March 2020
Offline
Hi,


Is it possible to extract node presets to an ascii format? (I'm looking for something similar along the lines of hexpand/hcollapse, which does the same for .hip files, or hotl for .otl files).

This would be very useful – it would allow merging of preset files, storing them in a git repo in ascii format, etc.

Any ideas are much appreciated


imre
Imre Tuske
FX Supervisor | Senior FXTD @ Weta FX

qLib -- Houdini asset library
http://qlab.github.io/qLib/ [qlab.github.io]
https://www.facebook.com/qLibHoudini [www.facebook.com]
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
hey riviera, have you tried saving a preset from the ear menu in the parameter window? this saves an IDX file which is “kinda” of ascii

If not, writing a python node or script that exports a preset as XML is actually pretty simple using python minidom.
-G
User Avatar
Member
14 posts
Joined: Dec. 2005
Offline
grayOlorin
hey riviera, have you tried saving a preset from the ear menu in the parameter window? this saves an IDX file which is “kinda” of ascii

If not, writing a python node or script that exports a preset as XML is actually pretty simple using python minidom.

Well, the “kinda” ascii won't do – it's the same ‘kinda’ as .hip files, but since I want to put these in a git repository, I'd need them to be full ascii.

Also, since all presets for a node are stored in a single file, it's kinda complicated to merge preset files between users.
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
Ah good point! I would definitly recommend the xml minidom route then
-G
User Avatar
Member
224 posts
Joined: Nov. 2008
Offline
I used lxml etree for parsing data to xml.
Also because it has a c wrapper that is faster.

Good tutorial: http://lxml.de/tutorial.html [lxml.de]
Senior Technical Artist Guerrilla Games
User Avatar
Member
7046 posts
Joined: July 2005
Offline
Yeah IDX files are unfortunate You can use “hidx” to expand them but it looks like there is still uneditable stuff in there

I use “classic” Houdini presets, you need to set an env var first though:

HOUDINI_ENABLE_OLD_PRESETS = 1

This will let you save pure ascii files, though with minimal UI. I have RMB menu scripts though that work around this.

Cheers,

Peter B
Cheers,

Peter Bowmar
____________
Houdini 20.5.262 Win 10 Py 3.11
User Avatar
Member
1705 posts
Joined: March 2020
Offline
pbowmar
Yeah IDX files are unfortunate You can use “hidx” to expand them but it looks like there is still uneditable stuff in there


Not for me, so far – all seems proper ascii. I don't know how I missed this command. Thanks!


imre
Imre Tuske
FX Supervisor | Senior FXTD @ Weta FX

qLib -- Houdini asset library
http://qlab.github.io/qLib/ [qlab.github.io]
https://www.facebook.com/qLibHoudini [www.facebook.com]
User Avatar
Staff
1454 posts
Joined: July 2005
Offline
I had to look into this recently and remembered this post.

The non-classic presets are stored in an index file (binary) which can be expanded and collapsed to a directory structure with ‘hidx’. The expanded “Permanent Defaults” file contains a mix of ASCII and binary data. Most of it ASCII except for the portion after ‘opspareparmdef’ which is a CPIO packet similar to hip file format.

So to edit anything in that CPIO you will need to convert it to plain text. It's a pain but doable:
- do ‘hotl -x tmpdir mypresets.idx’
- filter or retrieve the portion of the “tmpdir/Permanent Defaults” file starting on the line after ‘opspareparmdef’ and ending before ‘opchannels’ tokens, and save it into a tmp.cpio file
- run ‘hcpio -i < tmp.cpio’ which writes “opspareparmdef” text file
- edit this text file as you wish
- run ‘echo “opspareparmdef” | hcpio -o -O opspareparmdef.new.cpio’
- replace the portion of the “tmp/Permanent Defaults” file between ‘opspareparmdef’ and ‘opchannels’ with the contents of “opspareparmdef.new.cpio” file
- do ‘hotl -c tmpdir mypresets.idx’ to finally arrive at edited presets

Hopefully the next work iteration on presets will make this kind of thing painless.
User Avatar
Member
7046 posts
Joined: July 2005
Offline
Woo. Well at least it's do-able Thanks Rafal for that.
Cheers,

Peter Bowmar
____________
Houdini 20.5.262 Win 10 Py 3.11
  • Quick Links