beautypg.com

Apple Shake 4 Tutorials User Manual

Page 235

background image

Chapter 8

Working With Macros

235

3

Set the xSize parameter to 75.

4

Set the ySize parameter to 40.

The result is an image that is 75 x 40 pixels.

To save the icon file:

1

Attach an Image–FileOut node to the Fit node.

2

In the File Browser, use the Directories pop-up menu to navigate to your $HOME/nreal
directory.

3

Open the icons directory.

You should have created this directory in the first step of the tutorial. If not, use the
Create Directory button to make this directory.

4

Type “Filter.RotateBlur.nri” in the File Name field, then click OK.

The new icon is assigned to the Filter tab. (The .nri extension stands for “Nothing Real
Icon.” )

5

Choose Render > Render FileOut Nodes.

6

In the Render Parameters window, set renderFileOuts to All.

7

Click Render.

A 320 x 243 thumbnail appears. (Yes, correct, it is rather bizarre to have a thumbnail
that is larger than the actual image being rendered.)
You now have the two necessary elements: the macro and the icon. You now need to
write the code to place both in the interface.

8

Quit Shake. (You must restart Shake to write UI code.)

9

Launch a text editor.

10

Paste (or type if you are reading the printed version of this tutorial) the following into
the text editor:

nuiPushToolBox("Filter");
nuiToolBoxItem("RotateBlur", RotateBlur(0,0,0));
nuiPopToolBox();
//These set the slider ranges for the blur parameter
//nuiDefSlider("RotateBlur.blur", 0, 400 );

The first line indicates the Tool tab where the macro is placed—the Filter tab in this
case. If the tab does not exist yet (for example, the MySwankFunctions tab), Shake
creates it for you. The second line adds the function into the tab. The first occurrence of
“RotateBlur” calls the icon file that you just created.