Saturday, October 11, 2014

rippleEditOnOff

rippleEditOnOff.py

Hi nukers i have created this little code for my friend request. I'm decided to share this code with you. Hope this will help you friends.

This code toggle on - off ripple edit mode in nuke. Select your roto shape and run the hot-key. This will really help full while edit rotoshape inside nuke. Here im using alt+q as keyboard shortcut. But you can use your combination of key's.

rippleEditOnOff.py work with nukes roto and rotopaint node. Tested several time and working fine. If you have any bugs or reports mail to satheesrev@gmail.com



Original Code:

### created by satheesh-r, Oct 2014.
### To toggle on & off nuke roto, rotopaint nodes ripple edit function.
### for bugs & reports: satheesrev@gmail.com

import nuke

def rippleEditOnOff():
    selNode = None
    try:
      selNode = nuke.selectedNode()
    except ValueError:  # no node selected
      pass
    getValue = selNode['toolbar_ripple'].value()
    if getValue == False:
        selNode['toolbar_ripple'].setValue(True)
    if getValue == True:
        selNode['toolbar_ripple'].setValue(False)
    else:
        return


menu.py:

import rippleEditOnOff
nuke.menu( 'Viewer' ).addCommand( 'rippleEdit/OnOff', 'rippleEditOnOff.rippleEditOnOff()', "alt+q")

Tuesday, September 30, 2014

extract selected roto shapes

extractSelectedShapes.py

This script extract selected roto shapes from selected roto, rotopaint node in nuke. Usually we use to do, copy the desired roto shapes and then create a new roto node and paste the shapes. If roto node contain baked tracker info, then we copy paste the entire roto node and then delete unwanted shape's from pasted roto node.

I have created extractSelectedShapes script to make this process automatically. Tested several times and working with nuke 6, 7, 8 versions. This code also work with roto shapes imported from silhouette and mocha.

How to use:

Select the roto shapes need to extract make sure your roto node selected.


Run the script. This script will prompt you to choose the output method. User can extract the selected shapes into one roto node or each shape into separate node.



If user choose single this code copy paste selected shapes into single roto node.


Master roto node remain same.


 
If user choose each, this code create multiple roto node and copy paste selected shapes into newly created roto nodes.


extractSelectedShapes also link the track info if master roto have roto information on root layer. So no need to worry about linking track info.

Sample video:



Hope this code help you friends. enjoy :)

For bugs and future request send mail to satheesrev@gmail.com.

Download: http://www.nukepedia.com/python/misc/extractselectedshape

Original code:

### created by satheesh-r July 2014
### to extract selected roto shapes from selected roto node. Tested with nuke 6,7,8.
### for bugs and reports: satheesrev@gmail.com

import nuke, nukescripts

def extractSelectedShapes():
    panel = nuke.Panel("extractSelectedShapes", 200)
    panel.addEnumerationPulldown('shapes goes to:\nroto node', 'single each')
    panel.addButton("cancel")
    panel.addButton("ok")
    showPanel = panel.show()
    userChoice = panel.value('shapes goes to:\nroto node')
    if showPanel == 0:
        return
    if showPanel == 1:
        selNode = None
        try:
            selNode = nuke.selectedNode()
            selXpos = selNode.xpos()
            selYpos = selNode.ypos()
        except ValueError: # no node selected
            pass

        if selNode:
            if userChoice == 'single':
                newRotoNode = nuke.nodes.Roto()
                newRotoNode['xpos'].setValue(selXpos+200)
                newRotoNode['ypos'].setValue(selYpos)
                newRotoNode['curves'].rootLayer.setTransform(selNode['curves'].rootLayer.getTransform())
                for selShape in selNode['curves'].getSelected():
                    shapeName = selShape.name
                    newRotoNode.setName(shapeName)
                    newRotoNode['curves'].rootLayer.append(selShape.clone())
            if userChoice == 'each':
                for selShape in selNode['curves'].getSelected():
                    selXpos = selXpos + 200
                    shapeName = selShape.name
                    newRotoNode = nuke.nodes.Roto()
                    newRotoNode['curves'].rootLayer.setTransform(selNode['curves'].rootLayer.getTransform())
                    newRotoNode['xpos'].setValue(selXpos)
                    newRotoNode['ypos'].setValue(selYpos)
                    newRotoNode.setName(shapeName)
                    newRotoNode['curves'].rootLayer.append(selShape.clone())

        else:
            nuke.message('
make sure you have selected your roto node\n
then try again :)')






 

Sunday, April 27, 2014

Inbetweener for silhouette

Inbetweener


Silhouette don't have the very use-full keyboard short-cut for jump half-way between frames like other software's have (nuke). In nuke you can jump half way through between key frames and frames by hitting 'alt+arrow' keys. But this future is missing inside silhouette.

One of my friend requested me to write script for jumping half way through between frames inside silhouette. Also he mentioned this will going to be more use-full for roto artists. So I have created this scripts months ago and like to share with public. Hoping this will help you friends.

This is what this script will do....


Keyboard short-cuts:

alt+x for forward.
alt+z for backward.


Tested several months. Working fine with Silhouette v5 plus, v4 plus not tested in previous versions.

For bugs and reports - satheesrev@gmail.com.

download scripts:

inbetweener


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

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

Windows: /opt/SilhouetteFX/silhouette v5.1/resources/scripts/
restart silhouette.

Wednesday, March 26, 2014

extractAlpha.py

extractAlpha.py

Usually we use "Shuffle" node to extract alpha from ID mattes. Some of us use "Expression" node to do the same thing. Some time we need to use basic maths function in "Expression" node to get exact matte. This code create 'Expression' node and feed the value from the window. It also clamp the value. So no need to worry about the clamp issue.

Example maths function: r, (r+b)-g, (r+g+b), (r-g)

This code will pop-up small window like below image.,



User can select maths function from the list of drop-down menu. Most of the maths function's are pre-defined and stored on the UserChoice menu. This code allow user to feed their custom maths function. If user feed anything on custom math field this code will take the code and feed the info into the expression node.

Below video will explain how the function works:




Hope this will help you friends.,

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

nukepedia: extractalpha.py


Raw code:

'''
Created on 26-March-2014
@author: satheesh-R
mail - satheesrev@gmail.com
'''

import nuke

def extractAlpha():
    ea = nuke.Panel("extractAlpha.... by satheesh-R", 350)
    ea.addEnumerationPulldown('UserChoice:\n(pre-defined math)', 'none r g b a r+g+b r+g+b+a r+g r+b g+b r-g r-b g-b (r+g)-b (r+b)-g (g+b)-r')
    math = ea.addSingleLineInput('custom Math:', '')
    ea.addButton("cancel")
    ea.addButton("ok")
    show = ea.show()
    outChannel = ea.value('UserChoice:\n(pre-defined math)')
    customMath = ea.value('custom Math:')
    print outChannel
    if show == 0:
        return
    if customMath:
        exp = nuke.createNode('Expression')
        exp['expr3'].setValue('clamp('+customMath+')')
        exp['label'].setValue(customMath+'  to  alpha')
    else:
        if outChannel == 'none':
            return
        else:
            exp = nuke.createNode('Expression')
            exp['expr3'].setValue('clamp('+outChannel+')')
            exp['label'].setValue(outChannel+'  to  alpha')

Wednesday, February 26, 2014

connectMultipleMask

connectMultipleMask.py

Nuke having its won short key for connecting selected multiple nodes input into one target node. It is underedit menu. Goto edit --> node --> splay first will do the job. There are three more combination of shot keys with 'U'. Check with each one and enjoy. Thanks to Frank Rueter to give the information.

Even-though nuke don't have short-cut key for connect multiple selected nodes 'Mask' input to target node.

Tried with 'splayLast to A' 'splayFirst to A', But it connect single input nodes mask input to target node and fails with 2 or more inputs node.

check ref image:


Because splay short-cuts are working based on input order. Its not considering optional inputs. If input 0 is none it will connect 0 to target and so one so forth with other inputs :). Hmmmmm  good ya..

Yup then how to connect all selected nodes 'mask' input to target node with single click ?

Here is the script for connect multiple nodes mask input to target node. This script will connect selected nodes mask input to target node. It will do nothing if no mask input nodes.

check ref image:


connect multiple nodes masks input to target node. Make sure your selecting the target node at last. Select the nodes need to connect and then shit+select the target node. If select with mouse drag function make sure to select the target node at last. Then hit the short-cut key. Bang!!!!  all your nodes mask input connected with target node.

Hope this will help you friends.,

Download:

connectMultipleMask.py


Raw Code:


'''
@author: satheesh-R
for bugs and reports,,  mail - satheesrev@gmail.com
'''

### connect multiple nodes masks input to target node. Make sure your selecting the target node at last.
### Select the nodes need to connect and then shit+select the target node. If select with mouse drag function make sure to select the target node at last.
### Then hit the short-cut key. Bang!!!!  all your nodes mask input connected with target node.

import nuke

def connectMultipleMask():
    try:
        selNode = nuke.selectedNode()
    except ValueError: # no node selected
        pass
    selCheck = selNode.optionalInput()
    if selCheck > 0:
        for node in nuke.selectedNodes():
            min_inputs = node.minInputs()
            if min_inputs > 2:
                node.setInput(2, selNode)
            if min_inputs == 2:
                node.setInput(1, selNode)
            if min_inputs == 1:
                pass
    if selCheck == 0:
        for node in nuke.selectedNodes():
            min_inputs = node.minInputs()
            if min_inputs > 2:
                node.setInput(2, selNode)
            if min_inputs == 2:
                node.setInput(1, selNode)
            if min_inputs == 1:
                pass







Sunday, February 16, 2014

multiMatte

multiMatte v1.0

Today i searched my old hard drive and found some of my old tool's created for EYEON FUSION. Start to recreate those tools for nuke. multiMatte is my first tool.

Searched with google and found some multiMatte gizmo for nuke. Tryed everything But those tools are not working perfectly. So i decided to recreate the tool myself. Here is the multiMatte v1.0.


This gizmo allowing you to create matte from 9 channels. r,g,b,a,c,m,y, luma and black.

matteColor drop down menu allowing you choose the channels. Matte erode fine will expand and shrink the output matte (used some cool tech for erode the matte)

un-check bbox when input don't have bounding box. Otherwise matte erode will introduce bounding box and expand it. 

Expanding mask control tab allow user to invert the mask channel and blur the mask input.


By-default this gizmo output only converted alpha channel and remove other channels for efficiency. User can change the output method to "alpha to rgba".

Values are clamped So no worries about negative values Which i found other tools.

Tested with 6.3, 7.0 and 8.0.

Example:


Hope this will help you friends..,


Download:
multiMatte_v1.0

sample nuke script:
multiMatte sample script




Saturday, January 18, 2014

Export Maya camera and Objects to Nuke

Export Maya camera and Objects to Nuke

Exporting Maya Camera and Objects to Nuke is really night-mare. Using .fbx file format will fail most of the time. Scene not align perfectly, meshes not displaying properly, Camera missing the key-frames, etc. Reason for this is both the software's handling Cameras in different manner.

There are several scripts available for exchanging data's between mayaToNuke. Each one having their plus and minuses. I found a clever python script to do the data exchange successfully. I done some custom with the original script and used it several time with out any failure.


I created a new maya scene for tutorial purpose with animated camera and couple of objects.

Maya to nuke traditional export method:

Step-1: Selected all the objects and Camera.
Step-2: Go to  file---> Export Selection....



step-3: Go to Edit Presets and Change fbx format to fbx2010.


step-4: Export Selection and save it as a .fbx file.

step-5: Added ReadGeo node and import the saved .fbx file.
checked all the objects in ReadGeo node to load all the objects. When export animated geometry .fbx format failed most of the time



step-6: Added Camera node. Checked read from file. Imported the same fbx file.
My camera imported with out any key-frames inside nuke.


Maya to Nuke Using the python code:

step-1: Download the script and place it your custom DIR.

step-2: Start maya Load your scene and open script editor.

step-3: In script editor go to file---> Load script (or) hit ctrl+O and load script.



step-4: execute the script. It will back all the animation (camera, objects if animated)



step-5: Maya pops-up a window named mayaToNuke.


step-6: You can find several menu options in mayaToNuke window.

Edit:

1. Calculate Maya Data.
(This will bake the animated cam and objects)

2. Generate Nuke Script.

Select the objects you want to export.

Generates nuke script's. Exports selected objects into custom DIR as .obj files. This script creates a DIR named "mayaToNuke" into where the Maya scene file saved.

If your scene file is not saved it will prompt to save your scene. Hit enter save your script and run the script again.


It stores all the objects to the custom DIR. This script copy the nuke scene to clipboard and pop-up the success message.




Open nuke and paste. you can find Camera, objects and scan-line render node pasted into nuke.



3. Show Nuke script.
Maya pop-up a window with nuke script as text. You can copy paste the text into nuke.



4. Save nuke script As.
Maya will allow you to save the nuke script into where ever you want.

Type:
Select export type. Camera, mesh or all
This menu allow user to choose which needs to export. You can select all (all selected ) Camera only or Mesh only.

Animation:
Select animation type. Camera, mesh or all
If you check All it will export animated mesh as .obj sequence and Camera. Else it will export objects as single .obj file and camera.

check below video for more info:

https://www.youtube.com/watch?v=dXJ0_rp8OQM



Networks:

None: Only the original node
Base: Build basic 3d scenemayaToNuke
ContactSheet: Contact camera.

Maya Vray physical Camera:

This script working fine with Vray physical Camera in maya.






Tested with maya 2013 and V-Ray 2.30.01.


Thanks to pzhaojing for giving us the awesome script.


Original script:
http://www.creativecrash.com/maya/script/maya2nuke-v2


Download below script and enjoy...

Modified script:
https://drive.google.com/file/d/0BzfeLEFhrh44T3Z2REpyckF0aW8/edit?usp=sharing


Hope this will help you friends. feedbacks and bugs welcome.

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