Prev | Next


The IceMan Scripting Environment


Overview

To script image processing operations within It requires writing expressions in the IceMan scripting environment. The IceMan scripting environment uses the Io language. The decision to write somethingin Tcl or IceMan is fairly simple. If you script needs access to the application objects then you must use tcl. IceMan scripts know nothing of the tcl application object or catalogs or sessions. If you script needs to perform mathematical or image processing then it should be written as an IceMan script. Of course it is very easy for you tcl scripts to compose IceMan scripts on the fly and execute them and for you to develop libraries of IceMan or tcl scripts that can be automatically loaded by "It" and executed as desired directly or by other scripts.

Every image in 'it' is represented by a tcl side Image object. Over in the IceMan environment each image is also represented by an object. There images are represented by a type called IceImage. This is a more direct representation of an image than the tcl side has. You can add two IceImages togther, use any of over one hundred image processing methods IceImage has to transform and create new IceImages. The environment has a more natural support for numbers (unlike tcl).

One extremely useful and interesting aspect of the IceMan scripting environment is how easy it is to extend existing objects. At this point it is worth introducing the colleciton of files used to implement It's environment that are included in their source form. You can find them under $RMSTREE/lib/it/. As an example of extending an object's behavior it is particularly common to want to add, subtract, multiply and divide images. IceImage of course has those operators and in their native form and you can type at the "It" console window:

        it IceExpr "e0 Sum(e1)"

The IceMan script is the part between inside the quotes. It will be evaluate the moment you press enter. You can read the expression as "send the image e0 the Sum message with the argmument of image e1. Not exactly a natural way of adding two things. Now open in a text editor the file $RMSTREE/lib/it/IceImage.io. This file is read in automatically by it on start up. You can see how we've added four new methods to the IceImage object to make it possible to write the following:

        it IceExpr "e0 + e1"

That is a bit more obvious and easy to remember. Adding two images together is one thing you might type directly but you'll often want to collect together more complex expressions and put them in a library routine. In the Io language that's called a method. It might also be helpful to look through IoUtils.io for a simple example of how to declare a new method in the Io langauge.

There is a relationship between 'it's tcl side Catalog object and a construct on the IceMan side called a namespace. For each catalog in "it" there exists a namespace on the IceMan side. Namespaces are kept track of by the IceRegistry object. When you execute an IceMan script it runs within one namespace and any images that are ceated from an expression are added to that namespace and therefore to the same catalog.

Also worth mentioning is the IceRegistry object also performs another important function. 'It' will start to stash least recently used images to a scratch directory if you open or create more than a set number of images. That threshold is set in the Preferences window. The operation of this tempory swapping to disk can be completely ignored by the script writer but for the mortally curious it is completely implemented within IceRegistry object which you can find in $RMSTREE/lib/it/IceRegistry.io

Main Scriptable Objects


Custom Extensions

You can extend or modify the IceMan scripting environment by loading your own .tcl files on 'it' startup. In your local copy of it.ini place:

	LoadExtension io /my/extensionpath/MyIceManExtensions.io

 


Prev | Next


 

 

Pixar Animation Studios
Copyright© Pixar. All rights reserved.
Pixar® and RenderMan® are registered trademarks of Pixar.
All other trademarks are the properties of their respective holders.