node = nuke.selectedNode() roto = nuke.createNode('Roto') trackerExist = nuke.Boolean_Knob('tracker_exist') trackerExist.setExpression('[exists [string range "[knob tracker_mode]" 1 end-11]]') trackerMode = nuke.Int_Knob('tracker_mode') trackerMode.setExpression('%s.transform' % node.name()) invertCheck = nuke.Boolean_Knob('invert_check') invertCheck.setExpression('tracker_mode == 1 || tracker_mode == 2 || tracker_mode == 5 ? user_mode == 1 : user_mode == 0') userMode = nuke.Enumeration_Knob('user_mode','user_mode',['match-move','stabilize']) for k in [trackerMode,trackerExist,invertCheck,userMode]: roto.addKnob(k) roto.knob('translate').setExpression('invert_check ? %s.translate : -%s.translate' % (node.name(),node.name())) roto.knob('rotate').setExpression('invert_check ? %s.rotate : -%s.rotate' % (node.name(),node.name())) roto.knob('scale').setExpression('invert_check ? %s.scale : 1/%s.scale' % (node.name(),node.name())) roto.knob('center').setExpression('invert_check ? %s.center : %s.center + %s.translate' % (node.name(),node.name(),node.name())) roto['label'].setValue('link [string range "[knob tracker_mode]" 1 end-11]\n[ expr { [value tracker_exist] == true ? "[value user_mode]" :"FAILED LINK" }]\n') roto.hideControlPanel() roto.setTab(0) roto.showControlPanel() nuke.extractSelected() roto.setXYpos(int(node.xpos() + 200), int(node.ypos() + 000))