Mtor
Slim Ribbox Scripting I


return to main index

Related Links
   Slim Ribbox Scripting 2
   Slim Ribbox Scripting 3
   Slim Ribbox Scripting 4
   Slim Ribbox Scripting 5
   Slim Ribbox Scripting 6


Introduction

Using Create Appearance->Ribbox->Ribbox an item called a ribbox can be added to a palette. Unlike most appearances whose editors contain many user interface elements, the editor for a ribbox contains just one item labelled "edit". On Windows OS "edit" opens a new NotePad document.

It is vital that whenever text is added or edited in a ribbox its NotePad document is CLOSED before rendering a scene. It is all too easy to create multiple versions of the text in a ribbox, and doing so always leads to weird errors!

Mtor copies the text contained in a Ribbox to the output rib file immediately before the RIB statements that describe the object to which a ribbox has been attached are generated. For example,the following ribbox text

    Opacity 0.5 0.5 0.5

would make the object to which it is attached semi-transparent! As long as the text in a ribbox represents properly structured rib statements it will be inserted by mtor into the output rib file.


Using a Ribbox

The best way of appreciating the value of being able to insert snippets of RIB statements into an output rib file is to look at a couple of examples. The following ribbox text can be attached to a Maya object such as a nurbs sphere (one unit in radius) or a polygonal cube (2 x 2 x 2). In either case the Maya object is simply acting as a proxy object and as such it will not appear in the final rendered image.

    Translate 0 -1 0
    Scale 0.2 1.0 0.2
    TransformBegin
        Translate 0 1 0
        Sphere 1 -1 1 360
    TransformEnd
    Opacity 0 0 0

This ribbox script scales a RenderMan (quadric) Sphere into a thin upright ellipsoid - something that might be useful as a (candle) flame. The Translations ensure that different scale factors would make the top of the ellipsoid appear to move up and down while its base remains stationary. Of course this could easily be achieved in Maya. However, the next script shows a way of "automatically" animating the movement of the ellipsoid.

    Translate 0 -1 0
    Scale 0.2 [expr noise($pct * 15) + 1] 0.2
    TransformBegin
        Translate 0 1 0
        Sphere 1 -1 1 360
    TransformEnd
    Opacity 0 0 0

The embedded TCL expression uses slims built-in noise() function to generate values that range from -1.0 to 1.0. A different value is generated for each frame of an animation by accessing one of Slims pre-defined variables - $pct. This variable returns a value between 0.0 and 1.0 depending on the percentage of the animation completed.

For more information about noise(), $pct and the other TCL facilities that are part of Slim refer to the Pixar document Tcl Scripting.





© 2002-6 Malcolm Kesson. All rights reserved.