n = nuke.thisNode() oValue = n['file'].evaluate() if os.path.isfile(oValue): (prefix, v) = nukescripts.version_get(oValue, 'v') v = int(v) n['file'].setValue(nukescripts.version_set(n['file'].value(), prefix, v, v + 1))
A few lines of python code I wrote to put in the beforeRender knob in Write node Python tab for auto versioning. That is if the file name matches the format of “_v##” frame padding digit doesn’t matter, each file will go up a version if the file already exists.
For my usage, this code still has a few flaws.
- It doesn’t version up to the latest version.
- Because of above, it will overwrites the next version if it already exists.