/*
 * CineMatte.ifx.pre
 * Written by Thomas Krehbiel
 *
 * AutoFX script to run the CineMatte hook.
 *
 * Inputs:
 *    Word(Arg(1),1) = Sequence number
 *    Word(Arg(1),2) = Total number of frames (N)
 *
 * Returns:
 *    0 if successful, non-zero on failure
 *
 */

OPTIONS RESULTS

base  = 'Autofx_CineMatte_'

colors = GETCLIP(base||'Colors')
output = GETCLIP(base||'Output')
drange = GETCLIP(base||'DRange')
ForceBlack = GETCLIP(base||'ForceBlack')
ForceWhite = GETCLIP(base||'ForceWhite')

IF colors = '' THEN colors = 0
IF output = '' THEN output = 0
IF drange = '' THEN drange = 0
IF ForceBlack = '' THEN ForceBlack = 0
IF ForceWhite = '' THEN ForceWhite = 0

Gadget.1 = 'CYCLE   130  5 170 14 "Screen Color:"' colors '"Blue/Green/Red/Cyan/Magenta/Yellow/Auto Detect/Detect Any Color"'
Gadget.2 = 'CYCLE   130 20 170 14 "Output:"' output '"Matte & Keyed FG/Composite Only/Matte & Composite/Matte Only/Keyed FG Only"'
Gadget.3 = 'CHECK   130 36  26 11 "Dynamic Range?"' drange
Gadget.4 = 'INTEGER 130 49  50 14 "Force Black:"' ForceBlack
Gadget.5 = 'INTEGER 130 64  50 14 "Force White:"' ForceWhite
Gadget.6 = 'TEXT    190 52   1  1 "(0 - 255)"'
Gadget.7 = 'TEXT    190 67   1  1 "(0 - 255)"'
Gadget.8 = 'END'

NewComplexRequest '"CineMatte"' Gadget 330 85
IF rc ~= 0 THEN EXIT rc

CALL SETCLIP(base||'Colors', result.1)
CALL SETCLIP(base||'Output', result.2)
CALL SETCLIP(base||'DRange', result.3)
CALL SETCLIP(base||'ForceBlack', result.4)
CALL SETCLIP(base||'ForceWhite', result.5)

EXIT
