f
f
Apple Store
Global SectionArticlesBookstoreDictionaryDownloadsDVDsEventsForumsGalleryJob ListingsNewsNewslettersSchools
 Advanced Search
USER: PASS:  Login  Register

Subscribe
Site Links
Home > Nuke > Tutorials > tcl scripting > Nuke and Tcl - basics II > Page 1 Change background colorChange background colorChange background colorChange background color
Nuke and Tcl - basics II
Tutorial by frank rueter
Login to add a Bookmark 0 votes for an average rating of 0.00

Updated:   05/22/06

Works on:    Windows  Linux  MacOS-X
Nuke Versions:   4.x
Readership Level:   Basic
Owner:   rueter
Author Name:  frank rueter

Nuke and Tcl - basics II


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:

proc howManyNodes {selected} {
if {$selected == 1} {
set nodeCount [llength [selected_nodes]]
set outputText "$nodeCount nodes are currently selected"
} else {
set nodeCount [llength [nodes]]
set outputText "there are $nodeCount nodes in the script"
}
return $outputText
}


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.



.

Login to add a Bookmark 0 votes for an average rating of 0.00

Related Learning Tools
Nuke Related DVDs

No Results.
Nuke Related Books



The Art and Science of Digital Compositing
Global DVDs



Shake: Tracking and Transforms

Top Rated Nuke Tutorials

1. proc to toggle viewers inputs on and off by frank rueter (05/19/06)
2. Nuke and Tcl - intro by frank rueter (05/17/06)
3. Nuke and Tcl - basics I by frank rueter (05/18/06)
4. Nuke and Tcl - basics II by frank rueter (05/22/06)
5. Iteration thru a script by throb (05/19/06)


Related Tips


Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 36 in /var/www/inc/fx_functions2.php on line 760

No Results to Display


More Tutorials by rueter

1. Nuke and Tcl - intro by frank rueter (05/17/06)
2. Nuke and Tcl - basics II by frank rueter (05/22/06)
3. reset curve operations by frank rueter (09/06/06)
4. Nuke and Tcl - basics I by frank rueter (05/18/06)
5. camera trigonometry by frank rueter (11/01/06)






Sponsors

Sponsor

Contact Us | Post Jobs | Post News | Post Events