The Cutter text editor is designed to assist artists create, edit and test
slim scripts. This tutorial provides a summary of Cutter's features There are two
types of slim scripts, those that define the UI for a shader (.slo)
imported into HyperShade and those that implement a Slim shading node.
The former are called appearance slim scripts; the latter are
called template slim scripts - both have the same .slim file extension.
How Cutter handles template slim scripts is dealt with in the tutorial
Cutter: Slim Template Scripts.
Appearance .slim Scripts
When a shader (.slo) is imported into HyperShade the RfM plugin (RenderMan for Maya) references the shader and searches for an optional slim file with the same name as the shader. If the script is found the information it contains directs RfM to lay out specific widgets in the shaders attribute editor to control the parameters of the shader.
Step 1 - Creating an Appearance
Open a shader source code file in Cutter. For the purposes of illustration the following code, taken from the tutorial RSL: Color By Height, will be used to demonstrate the capabilities of Cutter.
Compile the RSL source code using the keyboard shortcut alt+e or control+e
or apple+e. Cutter will generate and save a slim appearance script in the same directory
as the compiled shader. A copy of the slim script can be found
Although each shader parameter has its default value
defined in the RSL code, Cutter uses a few rules when it generates the
parameter blocks in an appearance slim file. For example, parameters that
begin with upper-case 'K' have their min/max range set from 0.0 to 1.0.
float minheight = 1.25
have their ranges set to 0.0 to twice their default value ie. 0.0 to 2.5.
Step 2 - Controlling an Appearance
Cutter never guesses if a float parameter should be presented in HyperShade as a checkbox rather than a slider. For example, if an additional parameter,
float swapColors = 0;
was added to colorByObjOrigin.sl, it would appear in the Maya's Attribute Editor as a slider rather than a checkbox.
However, Cutter looks for ui-hints embedded in the comments associated
with each parameter. For example, the ui-hint,
float swapColors = 0; /* Swaps min and max colors. [0 or 1] */
"tells" Cutter to specify a checkbox (a switch in Slim-speak).
Notice that the text of the comment becomes the popup description.
Although the tutorial
Cutter: Slim UI Hints lists the ui-hints that Cutter
recognizes another example of "ui-hinting" is given next. The ui-hint,
surface colorByObjOrigin(float Kfb = 1, minheight = 1.25, maxheight = 2.5; float swapColors = 0; /* [group "Colors" 0 or 1] */ color mincolor = color(1,0,0), /* [group "Colors"] */ maxcolor = color(0,1,0) /* [group "Colors"] */ )
would cause Cutter to write an appearance slim that defines the following UI.
© 2002- Malcolm Kesson. All rights reserved.