FXScript

From HandWiki
Short description: Scripting language

FXScript is a scripting language for Final Cut Pro and Final Cut Express.

FXBuilder is the scripting utility in which users are able to modify existing FCP FXScripts or program completely new ones. For example, to scale an image, only two lines are necessary to scale an image from its full size to half size:

scale(Region, CenterOfScale, 0.5, 0.5);
blitrect(ImageBuffer, OrigRegion, Destination-Buffer, Region);

First the region, which might be a rectangle, is scaled by the statement scale and its parameters. Then the statement blitrect copies a region of an image into a changed region. When the OrigRegion and the new Region have different sizes, Final Cut Pro scales the image to fit into the new region. A Statement is a command that accomplishes a single action. In our example, the statements are scale and blitrect. In FXBuilder users can create and test FXScripts, optionally in multiple windows.

FX groups

Inside Final Cut Pro/Express and FXScript are three types of effects:

  • Video Transitions, which change from one clip to another (for example, the Cross Dissolve). This FXScript type is called transition.
  • Video Filters, which change the picture for a whole clip (for example, the Color Balance). This FXScript type is called filter.
  • Video Generators, which create new video information and therefore use the actual Sequence Preset (for example, the Custom Gradient). This FXScript type is called generator.

Script structure

A FXScript has two parts:

  • The head state, which contains the script's name, type, and assigned group in the Browser. Users can also specify the input controls that are needed.
  • The body, which contains the actual script code.

Normally the flow of the script is from top to bottom. Users can take flow control by using loops (for example, For/Next) and conditional branches (for example, If/Else). FXScript also allows breaking scripts up into subroutines that can be called from other parts of the script by using their names.