superCrop
sCrop.py
Nuke's crop node missing the future of select a region and crop. So i found little cheat way to achieve this. This little script get the value from ROI and set the value to selected crop node.
Step - 1:
Add a crop node.
Step - 2:
Enable ROI draw mode by " alt+w "
Step - 3:
Choose your region using mouse drag on Viewer. Disable the ROI by " shift+w "
( currently 'roi' enable or disable is not accessible via python, So we have to disable it by manually )
Step - 4:
Run this code.
Video example:
Hope this will help you friends...
python code:
import os, math, nuke
def sCrop():
sel = None
try:
sel = nuke.selectedNode()
except ValueError: # no node selected
pass
if sel is not None:
### getting value from ROI
roiXY = nuke.activeViewer().node().roi()
crpX = roiXY['x']
crpY = roiXY['y']
crpT = roiXY['t']
crpR = roiXY['r']
### assigning value to Crop
sel['box'].setValue(crpX, 0)
sel['box'].setValue(crpT, 1)
sel['box'].setValue(crpR, 2)
sel['box'].setValue(crpY, 3)
else:
nuke.message('No Crop selected')
sCrop()
Comments
Post a Comment