Tcl
|
Introduction
The best source of information about Tcl - its written by the author of
the language - is, C:/some_directory/another_directory/myfile.tcl rather than, as one might expect using back slashes C:\some_directory\another_directory\myfile.tcl |
Why Use Tcl?
For artists who wish to make full use of RenderMan and Maya ie.
Maya + mtor + prman, it is very beneficial to know how to write
Tcl scripts. For 'better or for worse' Pixar choose Tcl as the
scripting interface via which artists can enhance their productivity
when using the mtor plugin.
In addition to using Tcl as a way of writing command line scripts
there are the additional benefits of knowing a language that has an
integrated, cross platform, GUI builder ie. Tk. |
Basic ConceptsAs already noted, the best source of instruction on Tcl is Tcl and the Tk Toolkit. However, the following comments that may help clarify the use of Tcl.
When a Tcl script is executed its text is chopped up, and often
the "pieces" are re-chopped, into items that become the inputs
to commands that perform the task or tasks defined by
the script.
The Tcl parser chops up the text into three words, set age 54
What appears to be a number is in fact a string ie. the numeral
'5' followed by the numeral '4'. The first word is the name of
a command. The Tcl system "looks up" the command in its library
and passes onto the command the inputs "age" and "54". At which
point our variable "age" assumes the numeric value of 54. As its
name suggests, the purpose of the set command is to assign a value.
The square brackets have nothing in common with MEL style arrays
but instead tell the Tcl parser to process the text within the
brackets before doing anything else. expr $age + 10
Again, the first word is the name of a Tcl command. Unlike the set
command, the expr command requires 3 inputs. The dollar preceeding
the word "age" ensures the actual numeric value is substituted for
the name of the variable. The dollar symbol tells the parser to perform
variable substitution. \ "" { } Refer to "Tcl and the Tk Toolkit" and/or the Tcl Cookbook for more information. |
© 2002- Malcolm Kesson. All rights reserved.