A First Example

< Previous | Contents | Manuals Home | Boris FX | Next >

A First Example

A simple Sizzle exporter script is listed below. The first line must contain “//SIZZLEX ”, starting in the first column. After that follows a file extension, and a human-readable name for the exporter. This information appears on SynthEyes File/Exports menu. SynthEyes picks up its list of scripts from reading the SynthEyes program folder (also a user-specific folder and optional additional folders), looking for files with a .szl extension and the proper header.

//SIZZLEX .tst Test Exporter @[


%.3lf\n",

DateTime("%a, %b %d, %Y %I:%M:%S %p") "\n"


"Number of objects " #Obj "\n" for (ob in Obj)

"Object name " ob.nm "\n"


shot = ob.shot f0 = shot.start f1 = shot.stop

for (frame = f0; frame <= f1; frame++) printf("Frame %d: %.3lf %.3lf %.3lf %.3lf %.3lf


frame, ob.x, ob.y, ob.z, ob.rx, ob.ry, ob.rz)

end


printf("%d trackers\n", #ob.trk) for (tk in ob.trk)

printf("Name %s %.3lf %.3lf %.3lf err %lf\n", tk.nm, tk.wx, tk.wy, tk.wz, tk.error);

end end


Message("Hi, this is a test")

The @[ sequence on the second line switches Sizzle into script mode. The Sizzle script is embedded in the file, the same as Javascript is embedded in an HTML web page.

At the beginning of a file, Sizzle reads the input, copying it to the output. When it encounters a @[ sequence, that denotes the beginning of some Sizzle script, which continues until the next ]@. Sizzle interprets everything between the

]@ and the @[ as if it was in “quotes” If you want the file to include the value of ten plus eleven, you could just write @[10+11]@ and it would appear as 21 in the output file. Of course, in a real Sizzle script, much more interesting expressions can be used, accessing shot, object, and tracker information.

This makes a different style possible:

//SIZZLEX .tsx Another test

This stuff just goes right into the file. There are @[#Trk]@ trackers in the scene, And @[Shot[1].length]@ frames.

I’d like to emphasize the following remark,

@[for (I = 1; I <= 10; I++)]@by repeating it 10 times…

@[end]@. That should be enough.

This style of scripting can be easier to read, especially when an output file format requires a lot of “boilerplate”. You can embed the Sizzle script into the file, or vice versa. Import and tool scripts start in regular ‘program’ mode, so no initial @[ is required.


©2023 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.