nuke.createNode hooks up nodes where possible based on the current selection, 
opens the node’s control panel (unless inpanel=False is passed), and sets any 
knob defaults on the node. It triggers both the onUserCreate and onCreate 
callbacks to run, and accepts knob values as a Python string representing a TCL 
list.

nuke.nodes.Class doesn’t connect the node, apply any knob defaults, open the 
node’s control panel, or trigger the onUserCreate callback, and it accepts 
keyword arguments for knob values.

Each method has advantages and disadvantages. You will find instances where 
using one is easier, necessary to trigger some behavior, or results in more 
succinct code.

To connect the Camera input of a ScanlineRender node, use <node>.setInput(2, 
camNode)


-Nathan



From: sanfx 
Sent: Wednesday, January 30, 2013 1:26 AM
To: nuke-python@support.thefoundry.co.uk 
Subject: [Nuke-python] creating nodes and connecting them

I started of with nuke python API i am curious to know what is the difference 
between the two methods to create node shown below?

      Code:  
      import nuke

      mainCam = nuke.nodes.Camera(name="mainCamera")
     

the above command creates a new camera node, but does not open the properties 
panel, however if i use the 

      Code:  
      nuke.createNode("Camera")  


the above creates camera and shows the properties panel, so what is the 
preferred way and what each has advantage over each other?

so what is the best way and secondly if I want to create a scanlineRender node 
but it should have mainCamera connected to the cam input of the scanlinerender 
node, how would i achieve that ?



--------------------------------------------------------------------------------

san


--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to