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.
Comments
same as script file name:
[file rootname [file tail [value root.name]]].yourextension
to get just the version:
assuming that you use "_" as a separator and that the version is the last thing on script name. (i.e anyfilename_v003.nk)
[lrange [split [file rootname [file tail [value root.name]]] "_"] end end]
to get just the version:
assuming the version is on the last 4 characters of the script name (i.e anyfilename_v003.nk)
[join [lrange [split [file rootname [file tail [value root.name]]] ""] end-3 end] ""]
When rendering several versions and being able to compare them later, one thing that I like is assigning a [date Hh;Mm; Ss;] to the quicktime file name render. That way you end with several files, instead of overwriting the existing render.
Do you happen yo know what the TCL command would be if you wanted to keep everything before the version?
So including everything but the last 3 letters of the filename?
If you use Nuke's background render, Nuke makes a copy of the script and renders from that. Your Write nodes will now name themselves according to the temp filename.
If you never use that functionality, TCL works great. If you do (or if your render manager makes copies of your scripts,) you might want to stick with a callback like this excellent example.
In our studio we like to use subversions, such as _v03_002 or _v03_roto_001 to save several copies of the same script.
It should have to be be then the _$$$_ part ot the name that include a v at the begining, such as v03
Any way to code that?
Thanks
[regexp -inline -nocase {vd+} [file tail [value root.name]]]
expected an indented block (, line 5)
I got a situation where I need to write mov from bunch of dpx...but I would like to take the name of the read file without numbering add _LUT to the name and write it out one folder above from where the dpx sequence is...everything happens in write node file out put...so
for example I got:
X:/0100_Project/DR/SHOTS/EP1_FINAL_v01/EP1_Shot_Kick/render/EP1_Shot_Kick_comp_v03_####.dpx
And would like to write it like this:
X:/0100_Project/DR/SHOTS/EP1_FINAL_v01/EP1_Shot_Kick/EP1_Shot_Kick_comp_v03_LUT.mov
Help please,
Thanks a bunch!
K.
[join [lrange [file split [value [topnode].file] ] 0 end-2] /]/[basename [file rootname [value [topnode].file] ]]_LUT.mov
I get path with one folder step above dpx files....get the file name without extension but leaves me the frame number...and thats not good...still not there...
This is my final expression, I used string range node to cut the last 4 digits...
[join [lrange [file split [value [topnode].file] ] 0 end-2] /]/[string range [basename [file rootname [value [topnode].file] ]] 0 end-4]LUT.mov
Each new version(render) should go into its own new folder right? so the folder needs to be atuomatically created. how could i do this?
when I use this code, is it possible to bring 'previous'version?
for example, 'IJ_COMP_TEST_v 16', can I get 'IJ_COMP_TEST_v15'?
Thank you!
RSS feed for comments to this post