Auto pivot

autoPivot.py

Transforming, rotating, skewing and scaling all are happening based on the pivot point in every image editing software. So placing the pivot point in right place will handy to do above things.

In nuke... transform node's pivot point set to centre based on the project format by default. If our image is in a part of the format.


While doing translate, rotate and scaling this causing some problem. To do uniform scale or rotate we will move the pivot to image centre or image bottom centre by holding " ctrl+mouse click ". But we cant place it exactly in the middle or bottom middle.

How to reduce this manual job ?

Auto pivot.py will help you to place the pivot to centre of the image or bottom centre of the image by using short-cut keys.

Pivot centre after run the script:


Pivot bottom centre after run the script:



Auto pivot needs "bbox" to perform this action. So keep your bbox set to the image size.

This little python script saving my time on my everyday work. Hope you too friends....

Download: autoPivot.py

Nukepedia:

script:

save below script as  autoPivot.py


'''
Created on 18-may-2013
@author: satheesh-R
mail - satheesrev@gmail.com
'''


import sys
import nuke

def centerPivot():
    for s in nuke.selectedNodes():
        s['center'].setExpression('[value name].bbox.r+([value name].bbox.x-[value name].bbox.r)/2', 0)
        s['center'].setExpression('[value name].bbox.t+([value name].bbox.y-[value name].bbox.t)/2', 1)
        s['center'].clearAnimated()

def bottomCenterPivot():
    for s in nuke.selectedNodes():
        s['center'].setExpression('[value name].bbox.r+([value name].bbox.x-[value name].bbox.r)/2', 0)
        s['center'].setExpression('[value name].bbox.y', 1)
        s['center'].clearAnimated()




menu py:

copy paste below codes into your muny.py.

import autoPivot

menuBar = nuke.menu("Nuke")
menuBar.addCommand('Edit/Node/autoPivot/centerPivot', 'autoPivot.centerPivot()', 'alt+t')
menuBar.addCommand('Edit/Node/autoPivot/bottomCenterPivot', 'autoPivot.bottomCenterPivot()', 'alt+shift+t')








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