Last active
November 5, 2021 14:56
-
-
Save tokejepsen/71e158b3c05718401e2d620fc8e6cc54 to your computer and use it in GitHub Desktop.
Nuke: Start, middle and end frame of each TimeClip
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 all TimeClips and run code. | |
Will produce a frame hold with start middle and end of the time clips. | |
""" | |
import nuke | |
frames = [] | |
for node in nuke.selectedNodes(): | |
node["selected"].setValue(False) | |
if node.Class() != "TimeClip": | |
continue | |
first = node["first"].getValue() | |
last = node["last"].getValue() | |
duration = (last - first) / 2 | |
frames.append(int(first)) | |
frames.append(int(last)) | |
frames.append(int(duration + first)) | |
frames = sorted(frames) | |
frame_hold = nuke.createNode("FrameHold") | |
frame_hold["first_frame"].setAnimated() | |
for count in range(0, len(frames)): | |
frame_hold["first_frame"].setValueAt(frames[count], count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment