Changing default values – Apple Shake 4 User Manual

Page 381

Advertising
background image

Chapter 14

Customizing Shake

381

nuiPopControlGroup();
nuiPushControlWidget(

“MyFunction.Color”,
nuiConnectColorPControl(

kRGBToggle,
kCurrentColor,
1

)

);

This is an older version of the Color control without the cool extra controls.

Changing Default Values

In the <ShakeDir>/include/nrui.h file:

nuiPushToolBox(“Color”);

nuiToolBoxItem(“Add”, Add(0,0,0,0,0,0));
nuiToolBoxItem(“AdjustHSV”, AdjustHSV(0));
nuiToolBoxItem(“Brightness”, Brightness(0,1));
nuiToolBoxItem(“Clamp”, Clamp(0));
nuiToolBoxItem(“ColorCorrect”, ColorCorrect(0));

...

In the include/nreal.h file, most functions have their default values declared, but not all
of them. To override the default values when you call the function, modify the line that
loads the function in the interface. If every parameter in a function has a default value
in a function, you can call the function with something like:

nuiToolBoxItem(“Clamp”, Clamp(0));

Normally, Clamp has about 8 values. Here, the 0 represents in the first argument, the
input image. 0 is used to indicate that no images are expected to be inserted, so you
can attach it to the active node. However, you can add additional parameters. For
example, the Brightness line above it has (0,1), 0 for the image input (no input) and 1
for the brightness value. Change the 1 to a different value to override it. You only need
to supply the parameters up to the one you want. For example, the following is the call
for the Text function:

nuiToolBoxItem(“Text”, Text());

To override the default font for the Text function, you have to supply the width, height,
bytes, text, and finally the font. The rest you can ignore afterward:

nuiToolBoxItem(“Text”, Text(

GetDefaultWidth(),
GetDefaultHeight(),
GetDefaultBytes(),
“Yadda Yadda”,
“Courier”
)

);

Advertising