Inappropriate behavior in all the wrong places – Apple Shake 4 User Manual

Page 922

Advertising
background image

922

Chapter 30

Installing and Creating Macros

The keepAspect slider now goes from 1 to 2.

Creating an On/Off Button

Rather than using a value (1 or 2) to indicate what the slider does, you can create an
on/off button. When the button is on, you want to maintain the aspect ratio. When off,
you do not want to maintain the aspect ratio. Again, the format information can be
found in “

Using Parameters Controls Within Macros

” on page 379. If you are reading

this document electronically, you can copy and paste the command.

To create an on/off button:

1

Replace the slider range function in the VidResizeUI.h file:

nuiPushMenu(“Tools”);

nuiPushToolBox(“Transform”);

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

nuiPopToolBox();

nuiPopMenu();
nuxDefExprToggle(“VidResize.keepAspect”);

The problem here is that it always returns a value of 0 or 1—0 is off and 1 is on. You
want values of 1 or 2 because that is what the macro is counting on. Therefore, you
must edit the macro.

2

In the startup file VidResize.h, add 1 to the test of keepAspect in the Select function:

...

SetBGColor1 = SetBGColor(Fit1, “rgbaz”,

bgRed, bgGreen, bgBlue, 0, 0

);
Select1 = Select(keepAspect+1, Resize1, SetBGColor1, 0, 0);
return Select1;

}

3

Save the file and start Shake.

Inappropriate Behavior in All the Wrong Places

If you start to see controls on parameters that you have not created, or if you see
other functions that have odd behaviors, make sure you have specified what function
receives the control. If you set:

nuiDefSlider(“depth”, 1, 2);

anytime Shake sees a parameter named “depth” (for example, if somebody makes a
macro to set bit depth to a certain value), it takes a range of 1 to 2. Therefore, ensure
that you preface the depth with a function name:

nuiDefSlider(“MyFunction.depth”, 1, 2);

Advertising