preferencesManager module

Manage custom (persistent) preferences and show them in the Nuke Preferences window

class preferencesManager.Preferences(creatorName, appName)[source]

Manages custom preferences and shows them in Nuke’s Preferences window: - Add regular Nuke knobs - Set defaults (even for string_knobs) - Emits a QSignal when a setting has changed so you can keep track

addKnob(inputKnob, defaultValue=None)[source]

Adds a knob to the Preferences. Before adding new knobs, all existing knobs are removed to preserve order in the preferences file. Add knobs in the order you want them to appear in the Preferences window.

Parameters:
Returns:

On success: The created knob, on failure: None

Return type:

nuke.Knob | None

changed

Triggered when a knob is changed NOTE: When clicking ‘cancel’ in the Settings window all knobs emit the knobChanged signal, thus also triggering this class’ ‘changed’ Signal for all knobs.

Returns:Knob that was changed
Return type:nuke.Knob
getKnob(knobName)[source]

Returns knob if it exists, Returns None if not

Parameters:knobName (str) – name of the knob. Can be simple or built name
Returns:If found: Knob, if not: None
Return type:nuke.Knob | None
removeApp(appName, creatorName=None)[source]

Remove all knobs associated with the specified appName. If creatorName is not specified the creatorName set at instanciation is used. If no more knobs by the specified creatorName are present after removing the app, the creator’s tab is removed as well. Use with caution!

Parameters:
  • appName (str) – Name of the app to remove
  • creatorName – Name of the creator of the app, defaults to None
  • creatorName – str, optional
removeCreator(creatorName)[source]

Remove all knobs associated with the specified creatorName. Use with caution!

Parameters:creatorName ([type]) – [description]
removeKnob(knobName)[source]

Removes knob with the specified name

Parameters:knobName (str) – Name of the knob to remove
Returns:If a knob was removed: True, if not: False
Return type:bool
resetAllKnobs()[source]

Resets all knobs to their default value.

resetKnob(knobName, _save=True)[source]

Resets the specified knob to its default value

Parameters:
  • knobName (str) – Name of the knob to reset
  • _save (bool) – Saves new value to preferences (only for internal use)
saved

Triggered when the preferences have been saved manually by this modules

Returns:‘’ / any
Return type:str / any