Adverti horiz upsell
Nuke and Tcl - basics I
Nuke and Tcl - basics I
rueter, added 2006-05-18 16:50:16 UTC 32,585 views  Rating:
(0 ratings)
Page 3 of 4

Using selections

Instead of manipulating an explicit node you can use the one that is currently selected in the DAG. This is handy to get generic information from nodes without having to rewrite the command to update a node name.

syntax:

selected_node

selected_nodes


This will not return the node's name but it's ID so to get a selected node's name you would do something like this:


example:


puts [knob [selected_node].name]


Again, you want Tcl to evaluate from the inside out: First you need it to find out the selected node's ID so you have to put "selected_node" into brackets to evaluate it first. Then you want to use that ID to find out it's name so you use brackets for the knobs command just like before. Once the outer brackets are evaluated you can print the result into the shell using "puts".


Another useful Nuke command is "knobs" to find out what knobs a certain node has:


syntax:


knobs {-a,w,d,v}


a,w,d andv are optional arguments to do the following:

  • -v: list knob name and value pairs
  • -a: list all knobs
  • -w: write addUserKnob commands
  • -d: list only knobs with non-default values
examples:

print available knobs for the currently selected node

knobs [selected_node]]

click for larger version

the following line will print all knobs for the currently selected node including some DAG specific things like position, thumbnails etc.

Also print the a knob/value pair instead of just listing the knob name.

knobs -av [selected_node]