• Mark Ingle

Enabling autosave by default in Houdini


I can't begin to express how many times the Houdini's autosave has saved me time and stress after a crash. It is also useful when I've had to refer back to a previous version which I hadn't manually saved as a new version.


But the autosave function isn't on by default in Houdini. And it's annoying having to enable it on every session of Houdini.


Thankfully, we can write a startup script to enable autosave by default!



HScript


The simplest way to get autosave enabled by default is using HScript. We can put this script in the scripts folder within Houdini's preferences folder.

Windows:

%HOME%/houdiniX.X/scripts
C:/Users/username/Documents/houdiniX.X/scripts

Mac:

~/Library/Preferences/houdini/X.X/scripts

In the scripts folder we can make a new text file using any basic text editor, and write out the code:

autosave on

Save this text file as 123.cmd


Also, duplicate 123.cmd and rename the copy: 456.cmd


The filename 123.cmd is very important, as Houdini searches for this file on every startup. It also searches for 456.cmd every time you load an existing .hip file.


So by having these two scripts, you are going to have autosave enabled no matter how you opened your current Houdini session.



Python


Houdini also recognizes 123.py and 456.py and runs them on a new session, and upon loading a file. You may want to use python instead for this script, to then be able to append more commands to be run on startup. Although Houdini and run both 123.cmd and 123.py no problem, it's simpler to have all startup commands in one place.


We can have a HScript command run in python by writing the following code in a text editor:

 import hou
 hou.appendSessionModuleSource('''hou.hscript("autosave on")''')

Save this file as 123.py


Duplicate 123.py and rename the copy to 456.py



Autosave Settings


The frequency and method of the autosave function can be set in Houdini by going to

Edit > Preferences > Save and Load Options.


The SideFX documentation on Save and Load Options can be found here:

https://www.sidefx.com/docs/houdini/ref/windows/mainprefs.html#persistence


#HScript #Python

23 views
  • White Vimeo Icon
  • White Instagram Icon
  • White YouTube Icon
  • White Facebook Icon
  • White LinkedIn Icon
  • gumroad_logo_white_edited

© 2015 - 2020 Mark Ingle