def rotoCheck ():
    curNode = nuke.selectedNode()
    premult = nuke.createNode('Premult', inpanel=False)
    premult.setName( 'tmpPremult' )
    checker = nuke.createNode('CheckerBoard2', 'boxsize 100', inpanel=False)
    merge = nuke.nodes.Merge2( name='tmpMerge', label='delete me' )
    
    merge.setInput(0, checker)
    merge.setInput(1, premult)
    
    checker.knob( 'boxsize' ).setValue( 150 )
    checker['centerlinewidth'].setValue(0)
    
    tmpDir = nuke.toNode('preferences').knob('DiskCachePath').value()
    tmpPath = tmpDir + '/rotoCheck.####.jpg'
    write = nuke.nodes.Write( file = tmpPath, name = 'tmpWrite' )
    write.setInput(0, merge)
    first = curNode.firstFrame()
    last = curNode.lastFrame()
    nuke.execute( write.name(), first, last )
    
    nuke.nodes.Read( file=tmpPath )
    
    for n in [premult, checker, merge, write]:
        nuke.delete(n)
    
    curNode.setSelected( True )
nuke.menu('Nuke').addCommand('LittleHelpers/roto check', 'rotoCheck()', 'alt+enter')
