Writing your own tcl procedure
If you want to tie your tcl code into Nuke's UI you should put it into an extra tcl procedure and store that in your plugin path to make sure Nuke has access to it. Here is how you do it:
To write a tcl procedure you use the "proc" syntax.
syntax:
proc
example:
this proc will return the number of nodes that are either selected or the overall number of nodes in the current script depending on which argument is used when it's called:
if {$selected == 1} {return $outputTextset nodeCount [llength [selected_nodes]]} else {
set outputText "$nodeCount nodes are currently selected"
set nodeCount [llength [nodes]]}
set outputText "there are $nodeCount nodes in the script"
}
Using a text editor of your choice you can save the above code and call the file "howManyNodes.tcl" (it's important that the file name is the same as the procedure name). Make sure you save the file into a directory that is part of Nuke's plugin paths (see the page 136/137 in the user guide)
Once the tcl proc is savely tucked away you can edit your menu.tcl to add a menu item for it like this:
menu "My stuff/count nodes/selected" {howManyNodes 1}
menu "My stuff/count nodes/all" {howManyNodes 0}
After restarting Nuke you should see a new menu called "My stuff" which should look something like this:
For more informaion on how to use the menu.tcl to add hotkeys, menus etc. check out pages 138/139 in the user guide.
Author: rueter
Submitted: 2006-05-18 21:49:49 UTC
Tags:
Software: Nuke
Views: 20,426
Related Items
-
Sten Mark II 3D Model
$75.00 (USD) -
Dinning chair and table 3D Model
$20.00 (USD) -
Quick and dirty medium/low res 45. Smith and Wesson handgun 3D Model
$25.00 (USD) -
Kimber Custom II SWAT 3D Model
$20.00 (USD) -
AMD Phenom II CPU 3D Model
$35.00 (USD) -
Quill pen and ink bottle 3D Model
$20.00 (USD) -
Cessna 550 Citation II 3D Model
$79.00 (USD) -
Blue Leaf II 3D Model
$5.00 (USD) -
Tire and Rim 3D Model
$9.00 (USD)