For other knobs, like the autosave time, you could set a knob changed
callback to reset the value to what you want whenever it gets changed,
which seems to catch that prefs panel cancel resetting it. You might also
want to disable it so users don't get frustrated trying to set it to
something themselves. Try this in init.py (using 9.0v6, ):

nuke.toNode('preferences')['AutoSaveTime'].setValue(33)
nuke.toNode('preferences')['AutoSaveTime'].setEnabled(False)

def fixPrefs():
  k = nuke.thisKnob()
  if (k.name() == 'AutoSaveTime'):
    print 'fixing AutoSaveTime'
    k.setValue(33)

nuke.addKnobChanged(fixPrefs, nodeClass="Preferences")



On Tue, Aug 25, 2015 at 8:42 AM, Ben Dickson <[email protected]> wrote:

> This should be doable with the nuke.addAutoSaveFilter callback
>
>
> http://docs.thefoundry.co.uk/nuke/80/pythondevguide/callbacks.html#autosavefilter
>
>
> On 25/08/15 11:56, Den Serras wrote:
>
>> I wonder if I'm going about this all wrong, considering the dearth of
>> information on this out there...
>>
>> I'm modifying some of the preferences in our Nuke setup globally,
>> notably the autosave location, which is a custom location (not the same
>> as the default environment variables). I set those preferences by
>> changing the knobs and then using a hacky script I found on the forums
>> by Javier Garcia to save the preferences. If I don't do the save, then
>> if the user opens the prefs and hits cancel, the changes are lost.
>>
>> It seems like a backwards way to solve some of this. There should be
>> some kind of studio preference which simply overrides any user values.
>> Is everyone just using this same trick?
>>
>> Thanks!
>> Den
>>
>>
>>
>>
>> _______________________________________________
>> Nuke-python mailing list
>> [email protected], http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
> --
> ben dickson
> 2D TD | [email protected]
> rising sun pictures | www.rsp.com.au
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to