Tuesday, December 17, 2013

switchMatte

switchMatte v2.0

So long before i created this tool for my personal use. Recently improved the tool with extra control's.


switchMatte v2.0 works like shakes switchmatte and Fusion matte control. Added spill control with in the node So user no need to add extra Spill nodes.

switchMatte v2.0 interface.



Matte channel drop-down menu allowing you to choose the matte channel.

User can expand and blur the alpha channel. Luma threshold slider can increase and decrease the luminance value.


Despill menu allowing you to remove the spill from the image. spill only edges control the despill area. 

Download and play with this tool and leave the comment and requests.


Download: http://www.nukepedia.com/gizmos/channel/switchmatte

Saturday, October 26, 2013

rename roto shapes in silhouette

rename_shapes.py

I know this is for another application. Anyhow this script will help you friends. So im sharing this with you.

I searched very long some python code for rename roto shapes in silhouette. I tried my self sometime but can't make it exactly what i want. Accidentally i got the script from Johnny Chan's web site.
http://picostyle.com/scripts/

I made some changes with his script to make it more usable. You can customize as per your need. Hope this will help you friends.



This code will take the Layer name and replace the name to shapes inside the Layer. So no need to rename your hundreds and hundreds of roto shapes manually inside silhouette.

Follow below steps To make it work..

Before:





1. Rename your Layer:





2. Go to satheesh in menu bar. Under satheesh you can find Rename-> Rename shapes.  select . ( silhouette 5plus)

Go to Action in menu bar. Under Action you can find Rename-> Rename shapes.  select . ( silhouette 4 or below)

silhouette 5 above...



silhouette 4 and below.


After:


 
That's it....

Thanks to Johnny Chan's for this most usefull code.

Download: http://sdrv.ms/1a7ztlM

There are 2 python codes inside the file. One for silhouette 5plus and another one for silhouette 4 and below.

Installation:
download the script and Copy paste it into....

Linux:  /opt/SilhouetteFX/silhouette v5.1/resources/scripts/actions/
(you have to change permission to copied file. Run this command in shell...  chmod 777 -R /opt/SilhouetteFX/silhouette v5.1/resources/scripts/actions/rename_shapes.py)

Windows: C:/Program Files/SilhouetteFX/Silhouette v5.0/resources/scripts/actions/
Restart silhouette. Enjoy :)


Tested with windows and Linux. Working fine with silhouette v5 and v4.1.


Saturday, October 12, 2013

Bake tracker to Roto

trackRoto.py

Everyday we are (compers) doing this process so many times. We use tracker information to do most of the Roto. For doing this we are doing following things:
 
Usually Some compers copy the Tracker node and paste it next to the Roto node which need to match-moved.

Some use to copy paste the Trackers animation value into roto node's Root transform.



Following first step will slow down out script. Think if you have 50-100 roto shapes with tracker node.

Connecting tracker values to roto node is best way, But connecting manually with so many roto node is time consuming process.
So found the solution to automate this process. trackRoto.py.

Run this code with tracker node selected. This will create a roto node with selected tracker nodes  track information baked. So draw shape at any point and it will follow the tracked object..

This code will bake tracking information based on your tracker node. If your tracker node enabled only transform information then it will connect only the transform value. If your tracker enabled TRS then it will connect all the information automatically.

Hope this will help you friends..... cheers..

Updated on 26/12/2013.

Now this code create default roto node while user selected other nodes or nothing is selected.

Download: https://drive.google.com/file/d/0BzfeLEFhrh44SUVKd284OHpyM2c/edit?usp=sharing

code:

##-------------------------------------------------
## trackRoto v1.1
## For bugs please email me at satheesrev@gmail.com
## Compatibility: Nuke v5 - v8 plus
##--------------------------------------------------

import nuke, os, re

def trackRoto():
        sel = None
        try:
                sel = nuke.selectedNode()
                X = sel.xpos()
                Y = sel.ypos()
        except ValueError:  # no node selected
                pass
        if sel is None:
                rt = nuke.createNode('Roto')
        if sel:
                NodeType = re.sub(r"\d", "", sel.Class())
                print NodeType
                if NodeType == 'Tracker':
                        rt = nuke.createNode('Roto')
                        rt.setInput(0, None)
                        rt.setXYpos(X+200,Y)
                        rt['translate'].fromScript(sel['translate'].toScript())
                        rt['rotate'].fromScript(sel['rotate'].toScript())
                        rt['scale'].fromScript(sel['scale'].toScript())
                        rt['center'].fromScript(sel['center'].toScript())
                        rt['opacity'].setValue(1)

                else:
                        rt = nuke.createNode('Roto')


menu.py lines:

import trackRoto
n = nuke.toolbar('Nuke')
n.addCommand('Edit/trackRoto', 'trackRoto.trackRoto()', 'O')


Saturday, September 28, 2013

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()

Sunday, September 15, 2013

nuke particle templates

Nuke particle Templates

Hi nuker's this page dedicated for nuke particle templates. I will keep update this page with different nuke particle template's. Enjoy.... 

1. sparks ( welding sparks)


This is simple sparks, you can manipulate as per your need.

Download:
sparks_v01.nk

Monday, September 9, 2013

Nuke 7.0 roto shapes to Nuke 6.0 - 6.3

Nuke 7.0 roto shapes to Nuke 6.0 - 6.3

Hi friends today i faced a problem with nuke roto shapes because of version-up. I done roto with nuke 7.0 and my friend need it for nuke 6.3. I just rendered as image sequence and send it to him. Everything is fine.  But the edit has changed later and frames extended at beginning of the shot.

So i searched with google and found a solution. Thank you foundry!!! always artist friendly..

They already have solution for this. They documented this with release notes. You can find this nuke 7.0v1 release notes page no 8.

If you want Nuke 7 scripts to load in Nuke 6, use the convertToNuke6 or
convertDirectoryToNuke6 Python functions when running Nuke 7 in
terminal only mode.
Here is the step to convert nuke7 rotoshape to nuke 6 rotoshape.

Save your roto-shapes into new nuke file and save it into separate folder.

step 01.

open terminal and redirect to nuke7 installed DIR.

step 02.

Run nuke terminal mode.
for windows: Nuke7.0 -t
for Linux: ./Nuke7.0 -t
for OSX: ./Nuke7.0 -t    ( if this wrong let me know )

step 03.
enter below line and hit enter

import nuke.rotopaint

step 04.

enter below code with your nuke7 roto-shape file name and destination file name.
nuke.rotopaint.convertToNuke6 ("Nuke 7 rotofile", "destination file")

Example:

nuke.rotopaint.convertToNuke6("/home/satheesh/Desktop/rotoConvert/Test_nuke7_roto_v01.nk", "/home/satheesh/Desktop/rotoConvert/Test_nuke6_roto.nk")

For Nuke 8.0 above users:

Open the script which contain roto shapes in nuke 7.0v01(above) and save it as nuke script. Ignore all the warnings raised by nuke 7+. Now follow above steps.
( Nuke 7 doesn’t support open spline. So to avoid any error make sure your script don’t have open spline )

Now you can open the rotoshapes into nuke 6.0 - 6.3. While you import this into nuke first time. 

Nuke will through some error like below image




Just ignore this error and enjoy....  Hope this will help you friends.



Thursday, August 8, 2013

paintNodeOpacity.py

paintNodeOpacity python code


This little code will help you to control nuke "rotopaint" nodes clone & paint brush opacity via some short-cut keys. I created this code for my fellow artist who's working with me in paint department.

Short-cut keys are assigned as per his need. You can use your custom short-cut keys.




There are 5 control option.

"shift+>",  "shift+<"
user can up & down the opacity value using "shift+>" and "shift+<". This will jump between current value to +0.05 or -0.05.

If your value will 1 it start to decrease 0.95, 0.9, 0.85 so one so forth....


"ctrl+>", "ctrl+<"
 user can up & down the opacity value using "ctrl+>" and "ctrl+<". This will jump between current value to +0.01 or -0.01.

If your value will 1 it start to decrease 0.99, 0.98, 0.97 so one so forth....

"ctrl+Shift+<" and "ctrl+Shift+<"
This will return the opacity value to default 1 and 0.



Hope this will help you guys.


updated Aug19th:  Fixed NameError:. In previous version, while user accidentally hit these short-cut nuke will pop-up the name error. This issue fixed now and removed "please select rotopaint node" message.


Download: paintOpacity.py

else: copy paste below code:

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


import nuke, math, os

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

    if cls  == 'RotoPaint':
        for a in nuke.selectedNodes():
            getValue = a['toolbar_opacity'].value()
            newValue = sorted([0, getValue + 0.05, 1])[1]
            setVal = a['toolbar_opacity'].setValue(newValue)
    else:
        return

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

    if cls  == 'RotoPaint':
        for a in nuke.selectedNodes():
            getValue = a['toolbar_opacity'].value()
            newValue = sorted([0, getValue + 0.01, 1])[1]
            setVal = a['toolbar_opacity'].setValue(newValue)
    else:
        return


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

    if cls  == 'RotoPaint':
        for a in nuke.selectedNodes():
            getValue = a['toolbar_opacity'].value()
            newValue = getValue - 0.05
            if newValue < 0: newValue = 0
            setVal = a['toolbar_opacity'].setValue(newValue)
    else:
        return

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

    if cls  == 'RotoPaint':
        for a in nuke.selectedNodes():
            getValue = a['toolbar_opacity'].value()
            newValue = getValue - 0.01
            if newValue < 0: newValue = 0
            setVal = a['toolbar_opacity'].setValue(newValue)
    else:
        return

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

    if cls  == 'RotoPaint':
        for a in nuke.selectedNodes():
            a['toolbar_opacity'].setValue(1)

    else:
        return

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

    if cls  == 'RotoPaint':
        for a in nuke.selectedNodes():
            a['toolbar_opacity'].setValue(0)

    else:
        return
_______________________________________________



menu.py

import paintOpacity

menuBar = nuke.menu("Nuke")

menuBar.addCommand('Edit/Node/paintOpacity/Up', 'paintOpacity.paintOpacityUp()', 'shift+>')
menuBar.addCommand('Edit/Node/paintOpacity/Down', 'paintOpacity.paintOpacityDown()', 'shift+<')
menuBar.addCommand('Edit/Node/paintOpacity/increase', 'paintOpacity.paintOpacityUpIncrease()', 'ctrl+.')
menuBar.addCommand('Edit/Node/paintOpacity/decrease', 'paintOpacity.paintOpacityDecrease()', 'ctrl+,')
menuBar.addCommand('Edit/Node/paintOpacity/default', 'paintOpacity.paintOpacityDefault()', 'ctrl+shift+>')
menuBar.addCommand('Edit/Node/paintOpacity/zero', 'paintOpacity.paintOpacityZero()', 'ctrl+shift+<')


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')

Saturday, July 13, 2013

Help full Nuke short-cut's

Some cool and very help full nuke short-cut's

Here i'm going to share some cool and very help full nuke short-cut's with you friends. These are all my favourite short-cut's inside nuke.

1. "ctrl+up arrow or ctrl+down arrow"

you can move your selected node to above or below the next node.

But this will not work with multiple nodes. You cant move multiple nodes with this short-cut. (you can create some python code for doing this)


2. "crtl+shift+c"

This will pop-up the selected nodes "tile_color" picker window. You can color code the selected node or nodes same time.


3. "ctrl+right arrow & left arrow"

This will jump into half of the time in your time line. example: If your current frame is 50 ctrl+left arrow will jump to 25th frame. If you give it again it will jumb into 13. Your mouse should in viewer window.



This short-cut also work with key frames. you can jump in-between the key-frames exactly.

4. "n"

will rename the selected node in the node graph.


5. "y" & "alt+y"

'y' connect the first selected node to next selected node.

"alt+y' connect the mask input with next selected node.



6. "r" with selection write node.

Hitting 'r' with selection a write node will take you to selected write nodes file path (DIR). User can easily read the rendered file's into nuke by using this short-cut. By default 'r' will take you to the home folder.



7. "alt+w" to draw new ROI region.

User can draw the ROI region as per their need by hitting 'alt+w'. This shortcut will reset the ROI and user can specify the area. 'shift+w' for toggle on & off of the ROI.

8. "ctrl+node selection"

Normal selection select any on node. "ctrl+node selection" will select all the nodes connected with your current selection. This will help you to copy the hole set-up for pre-comp and organize your script.

9. "render order" in write nodes.

This option will help us to render the write nodes in order. By using this we can source files from current render. You can use multiple pre-comps and then sourcing the files to next peace of comp.


This future will help us lot of the time. Personally this is one of my favourite future in nuke.

10. Numeric " / & * "

Scale-up and scale-down the bg input in rotoPaint node. User can scale up and down the reveal or clone source using these keys. Shift and alt with these keys will increase and decrease the scale up and down value.

Numeric " 0 & . "

These two keys rotate the bg input respectively minus and plus. Shift and alt with these keys will increase and decrease the scale up and down value.



Usual nudging  key's will move the BG X & Y.


11. "ctrl+enter" - "shift+escape"

ctrl+enter will open selected group node into group node graph.

shift+escape will close the current node graph.


12. "ctrl+L" in viewer.

"ctrl+L in viewer" will lock the current camera. It turns on the camera icon into red. User also do this by clicking the camera icon using mouse.

ctrl+ mouseClick will turn the camera mode interactive. The icon will turn into green color. User can animate the camera interactively by this way.
( this will work for Light and Camera)



Continue...... 

Friends you can suggest some more cool short-cut's.



Friday, June 7, 2013

Bouncing ball.... Using Nuke particle system.

Nuke particle system

After some request's i'm creating this post for various nuke particle example.

1. Bouncing balls using Nuke's particle system.

Here i  created simple bouncing balls scene using nuke's particle systems. I used some "trick" to create shadows and hiding the objects while rendering using some shader trick. 

Example video:



This is the node graph of this nuke script.



Hope this will help you guys.  More particle tut's in future......




Saturday, May 25, 2013

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')








Saturday, April 27, 2013

Export Nuke's retime information

Export Nuke's retime information To 3D packages:

This is happen while working with production. In most cases retiming is done beforehand or at the end of a comp. Some time shots getting retimed after Match-move is done. By that time Nuke's retime data (curve) will help to match the tracked camera to new retimed plate.

Here is the trick to export nuke's retime date (curve) to 3D packages such as maya, max, Houdini etc. Here im explaining how to export nuke's retime curve to maya.

Constant re-speed.

I want to retime my input by 200%.

Add a retime node and change the speed to 2. Don't forget to change the filter option to None.


Retime node doesn't generate retime curve at all. So note down the output range. It changed from original range 1001 - 1042 to 1001 - 1021. Which means our input ended with 1021.

Add a TimeWarp node and set keyFrames based on our retime output result. Set a key frame at 1001 as 1001 in input frame knob. Goto frame 1021 and add a key-frame with 1042 on input frame knob. Don't forget to change the filter option to None.




Your timeWarp give the same result as retime node dose.


Export the retime data to Maya as Text file.

Goto TimeWarp node, add a user knob by right mouse click select manage user knobs, Add a integer knob and name it (here i using time). Then hit ok. Nuke will add a integer knob in-to TimeWarp node.


Now right click and select add expression on that custom integer knob. On expression tab add t and hit ok.


Goto curve editor select lookup and time. Right click ---> file ---> export ascii and select it. It will pop-up a window for exporting retime curve as ascii file (text file).


Select file path, name and hit ok by default. Nuke save a text file on your path. open it with text editor and look at it.


Nuke saves retime information on first column and time information on second column. But MAYA using it in reverse order. To import this into maya u need to mirror this information. How to do that.

Simple, Goto export ascii window and change the column for lookup to 2, and column for time to 1. Now nuke will store the informations how MAYA expect.



Import retime curve into MAYA and enjoy.

Re-time a Match-moved camera:

Now we are going to do above method in reverse order. We are going to retime the Match-moved camera inside nuke, instead of exporting retime curve to Maya from Nuke.

Import your Match-moved camera or generate camera using Nukes 'Camera_Tracker'.  Make a copy of it ( for safe).

Goto Translate knob, right click and select Edit expression. Add (farme * 2) at end on x,y and z column.

like below image:


If expression knob have 'curve' add like curve(frame * 2). Don't forget to add same expression to rotate knob's too.

After speed-up Camera (wireFrame cam).







For slow down use (frame / 2). Don't forget to add same expression to rotate knob's too.


After slowDowned Camera (wireFrame cam).




Here i used *2 for 200% speed up and slow downed. You have feed the values as per your shot.

Hope this will help you friends. Enjoy........  keep Nuking......




Sunday, April 21, 2013

flop flip in nuke

flopFlip.py

Nuke doesn't have this small and very handy utility built-in. For doing this function in nuke we need to use "VIEWER_INPUT" method (or) add mirror node and connect it with a (any) node, then constantly check and un-check the Horizontal or vertical knob. Finally you have to delete the mirror node.

flopFlip script dosen't need above step 's. Just press ctrl+F for flop, ctrl+shift+F for flip.

Before:



 After:




flopFlip will help you to flop & flip your current viewer result. I use to do this for checking my final comps and review my shots. Playback software's like RV, frame-cycler and other tools have this handy function.

flopFlip:



Hope this will help you friends.

download: flopFlip.py

nukepedia:  nukepedia

'''
Created on 21-apr-2013
@author: satheesh-R
mail - satheesrev@gmail.com
http://satheeshnuketutorials.blogspot.in/

Add following lines to your menu.py:

import flopflip

menuBar.addCommand('Edit/Node/flop', 'flopflip.flop()', 'ctrl+f')
menuBar.addCommand('Edit/Node/flip', 'flopflip.flip()', 'ctrl+shift+f')

'''

import nuke
import nukescripts

def flop():
    for i in nuke.selectedNodes() :
        nuke.selectedNode().setSelected(False)
    curViewer = nuke.activeViewer()
    curNode = curViewer.node()
    acticeVinput = curViewer.activeInput()
    curN = curNode.input(acticeVinput)
    name = curN.name()
    curN.setSelected(True)
  
    if name == 'flopFootageSatheeshR' :
        nukescripts.node_delete(popupOnError=True)
        nuke.selectedNode().setSelected(False)
    else:
        flop = nuke.createNode('Mirror', inpanel=False)
        flop.setName('flopFootageSatheeshR')
        flop['Horizontal'].setValue(True)


def flip():
    for i in nuke.selectedNodes() :
        nuke.selectedNode().setSelected(False)
    curViewer = nuke.activeViewer()
    curNode = curViewer.node()
    acticeVinput = curViewer.activeInput()
    curN = curNode.input(acticeVinput)
    name = curN.name()
    curN.setSelected(True)

    if name == 'flipFootageSatheeshR' :
        nukescripts.node_delete(popupOnError=True)
        nuke.selectedNode().setSelected(False)
    else:
        flip = nuke.createNode('Mirror', inpanel=False)
        flip.setName('flipFootageSatheeshR')
        flip['Vertical'].setValue(True)
Add following lines to your menu.py:

import flopflip

menuBar.addCommand('Edit/Node/flop', 'flopflip.flop()', 'ctrl+f')
menuBar.addCommand('Edit/Node/flip', 'flopflip.flip()', 'ctrl+shift+f')

Wednesday, April 3, 2013

Magic_CornerPin2D

Magic_CornerPin2D gizmo make your life easier to place your pin's on right place by single mouse click.




Added extra function called 'set To bbox' in From tab. Load Magic_CornerPin2D and goto From tab and click 'set To bbox' button..... pins are automatically placed based on input bounding box.


After click 'set To bbox'....


 Hope this will help you guys.

Download: from sky drive

sample script:

set cut_paste_input [stack 0]
version 6.3 v4CheckerBoard2 {
 inputs 0
 name CheckerBoard1
 selected true
 xpos -40
 ypos -267
}
Crop {
 box {275 380 1480 1015}
 name Crop1
 selected true
 xpos -40
 ypos -182
}
Magic_CornerPin2D {
 name Magic_CornerPin2D1
 selected true
 xpos -40
 ypos -105
 disable true
 "extra matrix" 0
 from1 {274 379}
 from2 {1481 379}
 from3 {1481 1016}
 from4 {274 1016}
}


Sunday, January 20, 2013

saveImage

saveImage.py

Hi nuker's finally found a solution for our long time wish and expectation. Now you can save image from the viewer. Like eyeon fusion and other application.

saveImage.py will allowing you to choose the path and file name and type. Now you can choose the image as any format (which ever nuke support). example jpg, tga, tiff, png et.

Added extra future channels. user can select channels to save image.

Added extra future while saving as exr you can choose the Data type. Default its in 16bit-half, either you can choose32-bit float. Fixed sub-sampling to 4:4:4 while save as .jpg.

Go to active viewer and right click select the save image as. It will pop-up a window like below image.




Choose your path and file type.


Hit ok it will save your active viewer result as image, It creates a read node and import your saved image into nuke.





If you forget to choose path and file type nuke will pop-up a message box like below image:


Hope this will help you Nuker's.

copy paste the following line to your menu.py.

nuke.menu( 'Viewer' ).addCommand( 'save image as', "saveImage.saveImage()")

Download from: nukepedia
Download from: skydrive


Add this script into your custom .nuke DIR as saveImage.py:

'''
Created on 19-jan-2013
Updated on 2 april 2016
@author: satheesh-R
mail - satheesrev@gmail.com
'''

import nuke, nukescripts
def saveImage ():

    ### Getting Lut list from root
    LutList = [n.split(" ")[0] for n in nuke.root()['luts'].toScript().split("\n")]
    Luts = '\n'.join(LutList)

    ### creating panel and assign buttons
    ef = nuke.Panel("saveImage As......  by satheesh-r", 420)
    ef.addFilenameSearch("Save Image As:\nchoose path & file type", "")
    ef.addButton("cancel")
    ef.addEnumerationPulldown('channels', "rgb rgba all")
    ef.addEnumerationPulldown('Color Space', Luts)
    ef.addEnumerationPulldown('Exr data type', "16bit-half 32bit-float")
    ef.addButton("ok")
    window=ef.show()

    ### getting values from panel
    exrtype = ef.value('Exr data type')
    channel = ef.value('channels')
    path = ef.value("Save Image As:\nchoose path & file type")
    colorSpace = ef.value('Color Space')
    fileType = path.split('.')[-1]

    ### User cancel the oparation
    if window == 0 :
        return

    ### if file format not found
    fileFormat = path.split('/')[-1]
    findDot = ('.')
    for dot in findDot:
        if dot in fileFormat:
            if dot == '.':
           
                ### getting path from user input
                if path == "":
                    nuke.message('no file path selected ')
                if path == "":
                    return
           
                ### getting active node
                curViewer = nuke.activeViewer()
                curNode = curViewer.node()
                acticeVinput = curViewer.activeInput()
                curN = curNode.input(acticeVinput)
           
                ### creating temp write
                w = nuke.createNode("Write")
                w.setName("tempWrite")
                w.setInput(0, curN)
                w['file'].setValue(path)
                w['colorspace'].setValue(colorSpace)
                w['channels'].setValue(channel)
           
                ### if file type is jpg
                if fileType == 'jpg' :
                    w['_jpeg_sub_sampling'].setValue(2)
                    w['_jpeg_quality'].setValue(1)
           
                ### if file type is exr
                if fileType == 'exr' :
                    w['datatype'].setValue(exrtype)
                    w['compression'].setValue(2)
                    w['metadata'].setValue(0)
           
                ### setting current frame for render
                curFrame = nuke.frame()
                if curFrame =="":
                  curFrame = curFrame
           
                ### execute write node
                nuke.execute(nuke.selectedNode(), (int(curFrame)), curFrame)
                name = w.knob('file').value()
                nukescripts.node_delete(popupOnError=True)
           
                ### create Read node
                r = nuke.createNode("Read")
                r['file'].setValue(name)
                curFrame = nuke.frame()
                r['first'].setValue(int(curFrame))
                r['last'].setValue(int(curFrame))
        else:
            nuke.message('forget to choose file format')
            return

Wednesday, January 2, 2013

shuffleAlpha.py

shuffleAlpha

Usually we use shuffle node to extract matte's from ID pass. For to do this we add a shuffle node and select the channel which need to be alpha channel.
 
This script will simplify this work, Its pop-up a panel (window)  called "selectChannel to shuffle" and you should choose your channel and click ok. This script will automatically done the above job. shuffleAlpha script also label the node like (red-->Alpha).

 Added extra future called "to All channel". By default "to All channel" is unchecked, If you select your channel and hit ok it will give you below result.
(This script keep other channels black rather then "alpha" channel)


I used to work like this, Because off work-flow optimisation. For more information about nuke work-flow optimisation tips.... nuke-workflow-optimisation-tips


With "to All channel" checked result:



Also shuffleAlpha.py will label the shuffle node according to your selection and create a stickyNote node and insert the result on it.


Added rgba to alpha. Some time we need to merge all channels together to alpha. If you select 'rgba' this script will create a expression node, merge all the channel together and convert it to alpha. Output value are clamped.







Hope this will help you friends.

Download from: nukepedia

Download from: skydrive

(or)

Copy below code and enjoy.


import sys
import nuke

'''
Created on 2 Jan 2013

@author: satheesh.R
contact: satheesrev@gmail.com
'''
## creating panel
def  shuffleAlpha():
    sa = nuke.Panel("shuffleAlpha.......  by satheesh-r", 400)
    sa.addEnumerationPulldown('selectChannel to shuffle', 'red green blue alpha rgba')
    sa.addBooleanCheckBox("to All channels", False)
    sa.addButton("cancel")
    sa.addButton("ok")
    result = sa.show()
    channel=sa.value("selectChannel to shuffle")
    value=sa.value("to All channels")
    ## continue the function if user hit ok
    if result == 0 :
        return

    if channel == 'rgba' :
        ex = nuke.createNode('Expression', inpanel = False)
        ex['expr3'].setValue('clamp(r+g+b+a)')
        ex['label'].setValue(channel+ ' ---> alpha')
        ex['note_font_size'].setValue(15)
        xpos = ex.xpos()
        ypos = ex.ypos()
        sn = nuke.createNode('StickyNote', inpanel = False)
        sn['label'].setValue(channel+ ' channels converted to alpha\n value clamped')
        sn['xpos'].setValue(xpos+110)
        sn['ypos'].setValue(ypos)


    ## Create shuffle node and set selected channel to all channels
    elif value == True :
        sh = nuke.createNode("Shuffle", inpanel = False)
        sh['alpha'].setValue(channel)
        sh['red'].setValue(channel)
        sh['green'].setValue(channel)
        sh['blue'].setValue(channel)
        sh['label'].setValue(channel+'-->All')
        sh['note_font_size'].setValue(20)

        ## add stickyNotes with shuffle information
        xpos = sh.xpos()
        ypos = sh.ypos()
        sn = nuke.createNode('StickyNote', inpanel = False)
        sn['xpos'].setValue(xpos+110)
        sn['ypos'].setValue(ypos+10)
        sn['label'].setValue(channel+ ' channel replaced\n with all channels')

    ## Create shuffle node and set selected channel to alpha channel only, keep other channels black
    elif value == False :
        sh = nuke.createNode("Shuffle", inpanel = False)
        sh['alpha'].setValue(channel)
        sh['red'].setValue('black')
        sh['green'].setValue('black')
        sh['blue'].setValue('black')
        sh['label'].setValue(channel+'-->alpha')
        sh['note_font_size'].setValue(20)

        ## add stickyNotes with shuffle information
        xpos = sh.xpos()
        ypos = sh.ypos()
        sn = nuke.createNode('StickyNote', inpanel = False)
        sn['xpos'].setValue(xpos+110)
        sn['ypos'].setValue(ypos+10)
        sn['label'].setValue(channel+ ' channel converted to alpha\n other channels switched to black')

        ## setting node tile color based on user selection
        if channel == "red" :
            sh['tile_color'].setValue(4278190335)
        if channel == "green" :
            sh['tile_color'].setValue(16711935)
        if channel == "blue" :
            sh['tile_color'].setValue(65535)
        if channel == "alpha" :
            sh['tile_color'].setValue(4278124287)

    else:
        return

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 ...