Making radio or toggle buttons – Apple Shake 4 User Manual

Page 926

Advertising
background image

926

Chapter 30

Installing and Creating Macros

The numbers immediately to the left of the icon listing, for example, the 0 in “0|ux/
vr_ntsc”, show the value returned when that button is clicked. The nice thing about
radio buttons is that they can return strings, float, or int. For example, the channel
parameter in the KeyMix node selects the channel to do the masking, with R,G,B, or A
returned, all strings. Because your macro VidResize only understands 0 or 1 to be
meaningful, use 0 and 1 as your return values.

7

Save the text file and start Shake again.

The radio buttons appear in the VidFormat parameters.

Attaching Pop-Up Menus

Although the radio buttons are pretty cool, another frequent option is a pop-up menu.
The pop-up menu is good when there are more choices than space in a standard
Parameters tab. The only catch is that they return strings (words), not numbers, so you
have to add some logic in your macro to interpret the strings. The following is the ui
code, which can also be found in “

Using Parameters Controls Within Macros

” on

page 379.

Making Radio or Toggle Buttons

There is an unofficial function to create these buttons. That’s right, you can use a
macro to help make your macros.

In doc/html/cook/macros, copy radiobutton.h and relief.h to your startup directory.

In the command line, type something like the following:

shake -radio “NTSC size” 79 vr_ntsc $HOME/nreal/icons/ux -t 1-4 -v

This creates four buttons named vr_ntsc.on.nri, vr_ntsc.on.focus.nri, vr_ntsc.off.nri, and
vr_ntsc.off.focus.nri in $HOME/nreal/icons/ux. Each button is 77 pixels wide and each
one saysNTSC size.“ You must do this in the command line because at the moment
the FileOut does not work in a macro unless it’s the command line, and frames 1-4
create the four different files.

Advertising