Automatic Write Node Versioning

if you run

nuke.root()['onScriptSave'].setValue("import re\n"+"rootVersion=re.search(\'[vV]\d+\',os.path.split(nuke.root().name())[1]).group()\n"+"for each in nuke.allNodes():\n"+" if each.Class() == \'Write\':\n" +" each[\'file\'].setValue(re.sub(\'[vV]\d+\',rootVersion,each[\'file\'].value()))")

your write nodes automatically increment their version number with the scripts version number when you save a new version of the script. 

So if you have a script called MyScript_v01.nk and a write node with a file path that ends with MyRenderFile_v01.mov when you do File:Save New Version it will make all your write nodes with version numbers match the new name of the script. so MyScript_v02.nk and MyRenderFile_v02.mov

The code goes into the onScriptSave box and when you save the script it uses re to split out the version number from the script name and applies it to all of the file knobs in all of the write nodes.

 

edit: made it a script command so it would be easier to apply.