Macro examples – Apple Shake 4 User Manual
Page 929

Chapter 30
Installing and Creating Macros
929
Variables
Macro Examples
The following are several examples of macros. Many of these macros can be found in
Chapter 32, “
,” on page 963, but they are not installed by default.
Parameter Testing: AutoFit
This macro resizes an image to fit a specified size along one dimension. For example,
suppose the images in a document are 300, 250, or 166 pixels wide. No matter what
size the screen snapshot, you can quickly resize it to one of the standard sizes and
easily keep the aspect ratio.
SetPixelScale(1,1):
-pixelscale 1 1
Pixel scale and ratio for the
script. See Chapter 4, “
SetDefaultWidth(720);
SetDefaultHeight(480);
SetDefaultAspect(1);
SetDefaultBytes(1);
SetDefaultViewerAspect(1);
If a node goes to black or if you
create an image node such as
RGrad, it takes this resolution by
default.
SetFormat(“Custom”)
Sets your defaults automatically
for resolution and aspect from
the precreated list of formats.
These formats are stored in your
startup .h file in the following
format:
DefFormatType(“Name”, width,
height, aspectRation,
framesPerSecond, fieldRendering);
Script Controls
Command-Line Equivalent
Description
Common Variables
Description
width
Returns the width of the current node.
height
Returns the height of the current node.
bytes
Returns the bit depth in bytes, either 1, 2, or 4.
in, outPoint
Returns the in and out frames of the clip in time.
time
The current frame number.
width/2
The center of the image in X.
height/2
The center of the image in Y.
dod[0], dod[1], dod[2], dod[3]
The left, bottom, right, and top edges of the Domain of Definition
(DOD) of the current image.
parameterName
The value of a parameter within the same node.
NodeName.parameterName
The value of a parameter in a separate node named NodeName.