connectCamera script for nuke

connectCamera python script for nuke

connectCamera script helps users to connect with any camera from anywhere in their nuke script. When you run this script it will find all the Camera's from the script, pops a window to choose the desired "Camera" from the list.



When you hit connect this script it will create a "Dot" node and connect with the selected camera. Also, add the selected camera name to the Dot.

Example video:


Download the script:


Raw code:

### connect camera v1.0
### connects user selected camera using a Dot node anywhere from the script
### for bugs and reports satheesrev@gmail.com
### thanks to Wouter Gilsing for helping out to make this happen

import nuke

def connectCamera():
    ###getting list of camera's available in the script
    cameraNames = ' '.join([n.name() for n in nuke.allNodes('Camera2')])
    if cameraNames:
        ###Creating nuke panel and storing informations
        panel = nuke.Panel("connectCamera", 100)
        panel.addEnumerationPulldown('selectCamera', cameraNames)
        panel.addButton("cancel")
        panel.addButton("connect")
        result = panel.show()
        selCamera = panel.value("selectCamera")

        ### return function when user hit cancel
        if result == 0:
            return
        else:
            ### creating DOt node and connect with selected camera
            dot = nuke.createNode("Dot", inpanel=False)
            dot.setInput(0, nuke.toNode(selCamera))
            dot['label'].setValue(' \n'+selCamera)
            dot['note_font_size'].setValue(20)
            dot['note_font'].setValue('Bitstream Vera Sans Bold')
            dot['hide_input'].setValue(True)

    else:
        nuke.message('No Camera Found\nimport some camera to connect')





Comments

Post a Comment

Popular posts from this blog

Export Nuke's retime information

Lock and unLock node settings in nuke

Working with UV pass inside NUKE