Last active
May 17, 2018 10:02
-
-
Save tokejepsen/370eaea72f247585d5f699638f16fb7a to your computer and use it in GitHub Desktop.
Nuke Latest Version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Select read nodes to find latest version. | |
Initial search range for versions are 50 versions up. | |
""" | |
import nuke | |
import nukescripts | |
nodes = nuke.selectedNodes() | |
search_range = [0, 5] | |
valid_paths = [] | |
for node in nodes: | |
if node.Class() != "Read": | |
continue | |
frame = node["frame"].getValue() | |
node["frame"].setValue("0") | |
for count in range(search_range[0], search_range[1]): | |
path = nuke.filename(node, nuke.REPLACE) | |
if os.path.exists(path): | |
valid_paths.append([node, node["file"].getValue()]) | |
nukescripts.version_up() | |
for count in range(search_range[0], search_range[1]): | |
nukescripts.version_down() | |
node["frame"].setValue(frame) | |
for node, path in valid_paths: | |
node["file"].setValue(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment