SUMMARY
This article outlines how you can automatically localize files from multiple different paths, as currently, Nuke’s auto-localize from feature only allows localization from one path by default.
MORE INFORMATION
Nuke:
You can automatically localize files from multiple locations in Nuke by writing a Python script, which you then add to your ~/.nuke/init.py file. Information about the init.py can be found here: Q100490: What are the init.py and menu.py startup script files
The example code below will localize files that are stored within either of the following file paths: /first/localization/path/ or /second/localization/path/
import nuke
localizationDrives = ('/first/localization/path/', '/second/localization/path/') #add paths you want to localize from to this tuple
def automaticLocalization(*localizeFrom):
if nuke.thisNode()['file'].value().startswith(localizeFrom):
nuke.thisNode()['localizationPolicy'].setValue('on')
nuke.addOnCreate(automaticLocalization, args=(localizationDrives), nodeClass="Read")The code works by first creating a tuple of directories to localize from. Then the function, called automaticLocalization, is defined. Inside this function, the code checks whether the current Read node's file knob has a value that starts with either /first/localization/path/ or /second/localization/path/
If this criteria is met, the Localization Policy for that node is set to on. The addOnCreate callback is then used to call the automaticLocalization function whenever a Read node is created in the Node Graph.
Hiero:
The exact same code as above can also be used to localize files in the Hiero timeline. However, for it to be executed on startup, this code would need to be added to your ~/.nuke/Python/Startup directory instead. Information about this can be found here: Q100142: How to execute Hiero Python code in Nuke Studio and Hiero on startup
Nuke Studio:
Adding the code to either your ~/.nuke/Python/Startup directory or your ~/.nuke/init.py file will work for both the timeline and Node Graph, so you should incorporate this into your setup to best suit your current pipeline and workflow.
FURTHER READING
There is currently a feature request logged for allowing the auto-localize from feature to accept multiple paths. The reference number for this is the following:
ID 147811 - Add the ability to Auto Localise from multiple locations, not just one
You can reference this number in the release notes of upcoming versions of Nuke to see if it has been addressed.
We're sorry to hear that
Please tell us why