{\rtf1\ansi\ansicpg949\cocoartf2708 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\froman\fcharset0 Times-Roman;} {\colortbl;\red255\green255\blue255;\red0\green0\blue0;} {\*\expandedcolortbl;;\cssrgb\c0\c0\c0;} \paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0 \deftab720 \pard\pardeftab720\partightenfactor0 \f0\fs24 \cf0 \expnd0\expndtw0\kerning0 \outl0\strokewidth0 \strokec2 #------------------------------------ # Cornerpin Reference Frame v.1.0.3 # Gabrielle Garam You, 2022 # modified typed_frame # set default ref_frame as the first frame of the script # set label as a ref_frame import nuke def cornerpin_refframe_tab(): n = nuke.thisNode() if not n.knob("Ref frame"): tab = nuke.Tab_Knob('Ref frame') n.addKnob(tab) ref_frame = nuke.Int_Knob('ref_frame','reference frame:') n.addKnob(ref_frame) nukeframe = int(nuke.frame()) n['ref_frame'].setValue(nukeframe) n['label'].setValue('[value ref_frame]') pyknob = nuke.PyScript_Knob('to_current_frame','current frame','current_frame()') n.addKnob(pyknob) def typed_frame(): n = nuke.thisNode() k = nuke.thisKnob() if k.name() == "ref_frame": n['from1'].setExpression('to1(ref_frame)') n['from2'].setExpression('to2(ref_frame)') n['from3'].setExpression('to3(ref_frame)') n['from4'].setExpression('to4(ref_frame)') n['from1'].clearAnimated() n['from2'].clearAnimated() n['from3'].clearAnimated() n['from4'].clearAnimated() else: pass def current_frame(): n = nuke.thisNode() n['ref_frame'].setValue(int(nuke.frame())) n['set_to_input'].execute() knob_to1 = n['to1'].getValue() knob_to2 = n['to2'].getValue() knob_to3 = n['to3'].getValue() knob_to4 = n['to4'].getValue() n['from1'].setValue(knob_to1) n['from2'].setValue(knob_to2) n['from3'].setValue(knob_to3) n['from4'].setValue(knob_to4) nuke.addOnCreate(lambda: cornerpin_refframe_tab(), nodeClass='CornerPin2D') nuke.addKnobChanged(typed_frame, nodeClass='CornerPin2D')}