Tuesday, August 6, 2013

autoPinning.py

auto pinning nuke cornerPin

 This little code place the cornerPin nodes 4 pin's automatically based on the bbox. If your image dosen't have bbox add a crop node and crop it as per your need.

Before:



After:





 
Download: autopinning.py


python code:


'''
Created on 04-august-2013
@author: satheesh
mail - satheesrev@gmail.com
'''

import sys
import nuke

def autoPinning():
    selNode = None
    try:
      selNode = nuke.selectedNode()
    except ValueError:  # no node selected
      pass

    if selNode is not None:
    ## auto pin for from
        selNode['from1'].setExpression('[value name].bbox.x', 0)
        selNode['from1'].setExpression('[value name].bbox.y', 1)
        selNode['from1'].clearAnimated()
        selNode['from2'].setExpression('[value name].bbox.r', 0)
        selNode['from2'].setExpression('[value name].bbox.y', 1)
        selNode['from2'].clearAnimated()
        selNode['from3'].setExpression('[value name].bbox.r', 0)
        selNode['from3'].setExpression('[value name].bbox.t', 1)
        selNode['from3'].clearAnimated()
        selNode['from4'].setExpression('[value name].bbox.x', 0)
        selNode['from4'].setExpression('[value name].bbox.t', 1)
        selNode['from4'].clearAnimated()

    ## copying value's from
        selNode['to1'].setExpression('[value name].bbox.x', 0)
        selNode['to1'].setExpression('[value name].bbox.y', 1)
        selNode['to1'].clearAnimated()
        selNode['to2'].setExpression('[value name].bbox.r', 0)
        selNode['to2'].setExpression('[value name].bbox.y', 1)
        selNode['to2'].clearAnimated()
        selNode['to3'].setExpression('[value name].bbox.r', 0)
        selNode['to3'].setExpression('[value name].bbox.t', 1)
        selNode['to3'].clearAnimated()
        selNode['to4'].setExpression('[value name].bbox.x', 0)
        selNode['to4'].setExpression('[value name].bbox.t', 1)
        selNode['to4'].clearAnimated()


    else:
      nuke.message('No node selected')

scale up and down cornerpin node

global scale up and down cornerpin This script help you to global scale up or down the selected cornerpin. Recently i had situation to ...