Houdini Python hou.setPreference()

   1492   4   1
User Avatar
Member
24 posts
Joined: 7月 2017
Offline
Hello all,
I am looking for a way to set a specific preference in Houdini with python. The preference I am looking to set is named “Auto Save Method” in the UI. I've tried to use the hou.getPreferanceNames() to get a list of all the pref name variables I can set but this does not appear in there.

I have had a dig through the preference files stored inside the Houdini folder and have found a parameter inside the hcommon.pref file that would seem to match the setting I am looking to change, however, if I were to edit this text file whilst Houdini is running, would that update the setting or would it require a restart of Houdini? And is it even a good idea to be editing these .pref files whilst Houdini is running?

Here is a link to the help file for the parameter I am looking to change, sorry I don't have a picture: https://www.sidefx.com/docs/houdini/ref/windows/mainprefs.html#persistence [www.sidefx.com]

You'll have to forgive me if this is very basic stuff, I am kinda new to Python in Houdini and am trying to make tools to learn more.

Thanks for the read!
User Avatar
Member
23 posts
Joined: 2月 2014
Offline
Hi, maybe you should double check names because when I type

hou.getPreference('general.autosaveinterval.val')

it returns ‘1’ meaning 1 minute. Your desired preference is below this, I think that it should be there…
User Avatar
Member
24 posts
Joined: 7月 2017
Offline
dkzone
Hi, maybe you should double check names because when I type

hou.getPreference('general.autosaveinterval.val')

it returns ‘1’ meaning 1 minute. Your desired preference is below this, I think that it should be there…

Hey dkzone,

Sorry, I've been meaning to update this to add clarity with a picture. I'm not after the interval (already got that one ), but the auto save method (See image linked below).

I've found what seems to be the file on disk that controls this parameter inside hcommon.pref, if I can't find a way of editing the preference via a python command I might just end up editing the .pref file directly through python but I am kinda unsure if its such a good idea to edit these files on the fly whilst Houdini is running.

Thanks for the reply though!

Here's the image:
Marked Image [imgur.com]
Edited by underscoreus - 2020年2月11日 15:02:49
User Avatar
Member
23 posts
Joined: 2月 2014
Offline
Or save hipfile through Python < custom Autosave. Didn't test. I save just with increment.
Edited by dkzone - 2020年2月11日 16:37:40
User Avatar
Member
24 posts
Joined: 7月 2017
Offline
dkzone
Or save hipfile through Python < custom Autosave. Didn't test. I save just with increment.
That is definitely also a solution I should look more into.

Thanks!
  • Quick Links