Saving and testing the macro, Position the foreground element – Apple Shake 4 Tutorials User Manual
Page 232

232
Chapter 8
Working With Macros
4
Indicate what you want to spit out of the macro with the return line. This is the final
image (or float, int, string) that you want to extract out of the macro function.
Remember the semicolon at the end of the line—in this case, return Rotate2, as it has
the result you need.
Add the return line:
image RotateBlur(
image input,
float angle,
float blur
)
{
Rotate1 = Rotate(input, -Rotate2.angle, 1, width/2, height/2, 0, 0.5, 0);
Blur1 = Blur(Rotate1, blur, 0, 1, "gauss", xFilter, "rgba");
Rotate2 = Rotate(Blur1, angle, 1, width/2, height/2, 0, 0.5, 0);
return Rotate2;
}
5
The following is the final macro. As a final touch, you should add default values for any
parameter, so it launches without having to add values in the command line.
Add the default values:
Note: Take special care with the commas.
image RotateBlur(
image input,
float angle = 45,
float blur = 150
)
{
Rotate1 = Rotate(input, -Rotate2.angle, 1, width/2, height/2, 0, .5, 0);
Blur1 = Blur(Rotate1, blur, 0, 1, "gauss", xFilter, "rgba");
Rotate2 = Rotate(Blur1, angle, 1, width/2, height/2, 0, 0.5, 0);
return Rotate2;
}
Saving and Testing the Macro
When this is done, save the file in your startup directory. Make sure the file name has a
.h file extension. Some text editors automatically append an extension. This is bad.
There is no correlation between the file name and the macro name.
To save the macro:
m
Save the file in your $HOME/nreal/include/startup directory:
/Users/Me/nreal/include/startup/my_macro.h