Modifying the macro interface – Apple Shake 4 User Manual

Page 913

Advertising
background image

Chapter 30

Installing and Creating Macros

913

Modifying the Macro Interface

The macro file in the startup directory merely creates the function. The interface is built
by Shake each time it is launched. Therefore, the MacroMaker also creates a second file
in the startup/ui subdirectory that creates a button and sets slider ranges for the node.
For example, if you created the new frequency slider in the above example, you may
have noticed that the slider only goes from 0 to 1. You can modify this in the ui file.

To modify the macro interface:

1

In the text editor, open the RandomMoveUI.h file (created in the above example) in the
nreal/include/startup/ui subdirectory.

nuiPushMenu(“Tools”);

nuiPushToolBox(“Transform”);

nuiToolBoxItem(“@RandomMove”,RandomMove());

nuiPopToolBox();

nuiPopMenu();
nuiDefSlider(“RandomMove.motionBlur”,0,1,0,0,0);
nuiDefSlider(“RandomMove.shutterTiming”,0,2,0,0,0.01);
nuiDefSlider(“RandomMove.shutterOffset”,-1,1,0,0,0.01);

The first line opens the Tool tabs. The second line opens the Transform tab. To place the
macro in a different tab, change the word “Transform” to a different name. The third
line creates the button. The first occurrence of the word “RandomMove” is preceded by
an @ sign, indicating that there is no icon (not related to Shake’s unpadded frame
wildcard) for the button, so therefore the text “RandomMove” should be printed on the
button. The second listing of the word “RandomMove” is the function that is called
when you click the button. Because you have default arguments already supplied in
the macro, you do not need to supply any arguments. If you did supply arguments,
they are placed between the parentheses: (). The last lines basically say “For the
RandomMove function, set the slider ranges for the shutterOffset parameter between
-1 and 1, with some extra granularity settings.” Since this sets the slider range, you can
copy it and adapt it for the new frequency parameter.

2

Copy the last line of code and paste in a copy. Change the word “shutterOffset” to
“frequency,” and adjust the values (based on the line in bold below):

...
nuiDefSlider(“RandomMove.shutterTiming”,0,2,0,0,0.01);
nuiDefSlider(“RandomMove.shutterOffset”,-1,1,0,0,0.01);
nuiDefSlider(“RandomMove.frequency”,0,10,0,0,0.01);

To add an icon to the button:

1

Create a 75 x 40 pixel image.

2

Save the image as TabName.Name.nri to your $HOME/nreal/icons directory. In the above
example, it would be called Transform.RandomMove.nri.

Advertising