Trees | Indices | Help |
|
---|
|
1 """ 2 Code for handling changes in the localization default in the preferences 3 and applying that as knob defaults on Read nodes. 4 """ 5 6 import nuke 7 from PySide2.QtCore import QTimer 8 9 10 # Name of the localisation policy prefs knob 11 kLocalizationPolicyDefaultKnob = "LocalizationPolicyDefault" 12 1315 """ Set the knob defaults for the nodes with the cacheLocal knob. """ 16 nuke.knobDefault("localizationPolicy", value)17 1820 """ Callback from the preferences node. If the default localisation 21 policy has changed, update it on the read nodes. 22 """ 23 knob = nuke.thisKnob() 24 if knob.name() == kLocalizationPolicyDefaultKnob: 25 updateReadKnobLocalisationDefaults(knob.value())26 2729 """ Get the default localisation policy from the preferences node and set 30 up the knob changed callback. 31 """ 32 prefsNode = nuke.toNode("preferences") 33 knob = prefsNode.knob(kLocalizationPolicyDefaultKnob) 34 updateReadKnobLocalisationDefaults(knob.value()) 35 nuke.addKnobChanged(onPrefsKnobChanged, node=prefsNode)36 37 38 # This script is imported before the prefs node is loaded. To ensure we get 39 # the correct initial value for the localisation policy, use a QTimer to defer 40 # initialisation. initCallbacks will be called once the Qt event loop is 41 # running. 42 QTimer.singleShot(0, initCallbacks) 43
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Dec 5 06:16:30 2017 | http://epydoc.sourceforge.net |