Finding all versions
I realized the other day Nuke’s default Alt + Shift + Up
hotkey, which calls nukescripts.version.version_latest()
doesn’t actually version up the read node to its latest version. What do I mean by that? If you have
v001
v002
v004
v006
Alt + Shift + Up
will up version the node to v002 and calls it a day. That is because the function sets up a loop of checking if version + 1 exists, if it doesn’t, it stops.
So I tried making a function that find all the available versions without iterating through v + 1. This uses python regex
and glob
to look through the folder structure instead.
glob
will get a list of all the files which matches the original file pattern, and regex will look through all the files and return a list of available versions like so:
[v001, v002, v004, v006]