Writing tools for read nodes!

Writing tools for read nodes!

This is me getting too lazy to deal with one read node at a time. Often I found myself keep repeating the process of selecting all the read nodes that I actually remember the python script that does it, and keep typing it up in the script editor. Finally I saved it down and became one of the two functions in this script. The other one is changing localization policy on nodes. This is usually not my decisions however, it’s more about when getting a nuke script from another artist and I found they have localization policy set differently than I’d like to. Sometimes I also ended up have some nodes localization policy set to something, while other nodes to something else. So I wrote a pop up panel that set localization policy on every node that have that knob. I also included a checkbox in it so that it changes read nodes only, or everything, like readGeo.

To sum it up:

Currently this tool only includes two scripts:

  1. selectRead: Click, and it’ll select all your read nodes!
  2. setLocalization: A simple pop up for you to set localization policy, for read nodes only or everything!

Note: ‘Convert file path to absolute’, ‘Select Nodes with File Knob’ and ‘Set Project Directory’ comes from another script called SetProjDir.


setLocalization expanded
As shown below ‘on demand’ is new from nuke11.1. If you select ‘on demand’ in previous versions it will simply becomes ‘off’.

Simple as that! I plan to add another pop up that changes ‘on_error’ knob, or perhaps merge it with the “Change localization” panel.


In the process of writing setLocalization I experimented with nukescripts.PythonPanel as I said I would in this post, which I explained a problem with using nuke.EnumerationPulldown while writing this function. I guess what’s unexpected is what really got me into looking into it is, the old nuke.panel doesn’t have a text knob.

I was surprised that nukescripts.PythonPanel was quite poorly documented, so I figured most of these on my own. Turned out I don’t necessarily needs to create a class or self as shown in nuke python developer guide if I just wanted a simple pop up panel.


p = nukescripts.PythonPanel('Change localization')

This will create a pop up panel.

p.checkboxKnob = nuke.Boolean_Knob('readOnly', 'Read nodes only', '1')
p.localizationKnob = nuke.Enumeration_Knob('localizationPol', 'Set localization policy', ['on', 'from auto-localize path', 'on demand', 'off'])
p.textKnob = nuke.Text_Knob('text', '', '"on demand" only available since nuke11.1')

All these to create the knobs that I want, needs to declare them as variables so that I can add

for k in (p.checkboxKnob, p.localizationKnob, p.textKnob):

Adding knobs into the panel “p” as declared in first line.

if p.showModalDialog():
if p.localizationKnob.value() == 'on':
c = 0

And to retrieve the values after the user press “Okay” when panel popped up.


I find it slightly more complicated than the simple nuke.Panel, but it is significantly easier to add knobs. Knob types available are here for future reference. Also to grab the values later the attribute value() seems more fitting in python, compare to something such as

p.value('file path')

in nuke.panel.



This tool is now available for download on nukepedia here. You will also find any future updates or development on that page.

One thought on “Writing tools for read nodes!

Leave a Reply

Your email address will not be published. Required fields are marked *