Skip to content

Instantly share code, notes, and snippets.

@julik
Created July 26, 2013 15:34
Show Gist options
  • Save julik/6089831 to your computer and use it in GitHub Desktop.
Save julik/6089831 to your computer and use it in GitHub Desktop.
Break out of the ReadGeo range with first/last frame holds
readgeo = nuke.selectedNode()
# register the first frame of the selected readgeo
hold_first = int(readgeo["range_first"].value())
# and the last frame
hold_last = int(readgeo["range_last"].value())
# generate the holds
hold_before = nuke.nodes.FrameHold(first_frame = hold_first)
hold_before.setInput(0, readgeo)
hold_after = nuke.nodes.FrameHold(first_frame = hold_last)
hold_after.setInput(0, readgeo)
# generate the switcher
switcher = nuke.nodes.Switch()
switcher.setInput(0, hold_before)
switcher.setInput(1, readgeo)
switcher.setInput(2, hold_after)
# Set 4 keys to avoid const curves
switcher["which"].setAnimated()
switcher["which"].setValueAt(0, hold_first-1)
switcher["which"].setValueAt(1, hold_first)
switcher["which"].setValueAt(1, hold_last)
switcher["which"].setValueAt(2, hold_last+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment