Last active
March 21, 2018 00:51
-
-
Save lclibardi/6275e9a1048c42d234f6a34f94594c6e to your computer and use it in GitHub Desktop.
A quick way to reset the feather curves in Nuke's Roto node
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
# Current frame on the timeline | |
frm = nuke.frame() | |
# Iterate over all Roto nodes | |
for rotoNode in nuke.allNodes('Roto'): | |
# Access the curves knob, then the root layer | |
curves = rotoNode['curves'] | |
rootLayer = curves.rootLayer | |
for spline in rootLayer: | |
spline = curves.toElement(spline.name) | |
# Iterate over each point in the spline | |
for pt in spline: | |
# Reset the center feather to a zero offset | |
pt.featherCenter.addPositionKey(frm, [0, 0]) | |
# Grab the current coordinates for the left and right tangents | |
lt_pos = list(pt.leftTangent.evaluate(frm).position) | |
rt_pos = list(pt.rightTangent.evaluate(frm).position) | |
# Match the feather tangents to the main tangents. We just need x and y | |
pt.featherLeftTangent.addPositionKey(frm, lt_pos[0:-1]) | |
pt.featherRightTangent.addPositionKey(frm, rt_pos[0:-1]) | |
# Update the curves view so we see the changes in the Viewer | |
curves.changed() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment