To designate that a function has no image input – Apple Shake 4 User Manual

Page 957

Advertising
background image

Chapter 31

Expressions and Scripting

957

does not work because you are drastically mixing your data types (plugging an image
into a float). There is one exception to this: when you enter 0 as an image input,
indicating that you do not want to designate any image input.

So far, you have only assigned variables to image types. In this next example, create a
float variable so you can multiply the truck image by the same amount on the red,
green, and blue channels. Call this variable mulVal.

Note: For these examples, you must save the script and use Load or Reload Script—the
Copy/Paste does not work properly.

To create a float variable to multiply an image by equal amounts in the red,
green and blue channels:

1

Create a script variable and plug it into the Mult node:

float mulVal = .6;
Gilligan = SFileIn(“/Server02/VolumeX/Scene12/

truck/bg.iff”, “Auto”, 0, 0);

Skipper = SFileIn(“/Server02/VolumeX/Scene12/truck

sign_mask.iff”, “Auto”, 0, 0);

Lovey = SFileIn(“/Server02/VolumeX/Scene12/truck

truck.iff”, “Auto”, 0, 0);

MaryAnn = Mult(Lovey, mulVal, mulVal, mulVal);
Thurston = Outside(MaryAnn, Skipper, 1);
Ginger = Over(Thurston, Gilligan, 1, 0, 0);

Mult now takes .6 for its red, green, and blue parameters. To change all three, modify
mulVal on the first line of the script and execute the script again. This is swell. However,
here is a problem. The variable mulVal is only applied when you load the script—Shake
does not retain it for later use. When the script is loaded (with Load Script, not Copy/
Paste) into the interface, the Mult parameters all read .6, not mulVal. There is no place in
the interface that you can find the mulVal parameter and modify it and have the Mult
take the argument. If you are immediately executing the script, this is not a problem. If
you are loading the script and are going to interactively edit it, this is a problem. You
therefore must declare mulVal as a curve float, a special type of float that tells Shake to
wait until frame calculation to resolve the variable.

2

Convert the mulVal variable to a changeable curve type:

curve float mulVal = .6;
Gilligan = SFileIn(“/Server02/VolumeX/Scene12/doc/pix

truck/bg.iff”, “Auto”, 0, 0);

Skipper = SFileIn(“/Server02/VolumeX/Scene12/truck/

To Designate That a Function Has No Image Input

Place a 0 in the image position. This example has no image input for the background
image, the second argument:

MaryAnn = Over(Thurston, 0);

Advertising