Writing Scripts Part #3


The next thing I'll describe is the "Flame interface". This gives you access  to global parameters of
the flame. The first group of Flame properties change the parameters that are available in the
Adjust window...

  • Gamma -- gives you access to the Gamma parameter that you see in the Adjust window.
    Values should be larger than equal to one (as lower values may crash Apophysis...in the
    future I'll make it impossible to set lower values).
  • Brightness -- sets the Brightness parameter as seen in the Adjust tab. Should be larger or
    equal to zero.
  • Vibrancy -- sets the Vibrancy parameter as seen in the Adjust tab. Should be larger or
    equal to zero.

Zoom, X and Y -- are hopefully obvious.

The SampleDensity, Oversample and FilterRadius properties don't affect the main display but will
have effect in script previews and script renders. You'll want to set these three properties before
scripting a render (it's equivalent to setting these parameters in the Render window).

As with the Transform interface you can set the properties individually using the format...

Flame.Gamma := 2;

...or in a group...

with Flame do
  Gamma := 2;
  Brightness := 3;
  Vibrancy := 1;

To render from a script you use the Renderer interface. The Renderer interface only has three
properties: Filename, Width and Height. Filename must be a valid Windows filename including a
path (if no path is included the final location of the rendered image might be unpredictable). The
path should be an existing folder. The filename should include the extension of the image file
format that you want to use. An example:

Renderer.Filename := 'C:\Documents\Flame.jpg';

The Width and Height properties determine the width and height of the image that you are going
to render. After setting these values you should call the SetRenderBounds method (see the
"Animation Render" script that I supplied). The SetRenderBounds method calculates the scale of
the flame in relation to  the image size. The Render method starts the render.

Now just mention a few more things...

If you don't want the changes that you've made to a flame in a script to affect the main display (if
you are creating an amimation for example), you can set the UpdateFlame paremeter to false.
Typing the following line anywhere in a script will do this...

UpdateFlame := false;

If you want to reset the location of the main flame after the script has run (if you are creating a new
flame or radically altering the existing one) then set the ResetLocation parameter to true...

ResetLocation := true;

There's a special parameter called "Stopped" that starts out false and only becomes true when you
press the black "Stop" button on the Script editor toolbar or the main window's tool bar. You can
use this parameter for the condition of a loop that will continue indefinitly until the user pressed
that button (a few other actions, like selecting a new flame from the file list, will also set stopped
to true).