< Previous | Contents | Manuals Home | Boris FX | Next >
Do It Like This: Procedures
The simple "means" rules are great for fairly simple things: alternative phrasing and a step or two in a compound sentence. For more complex multi-step procedures, Synthia offers an extensive set of rules about procedures. This is an introduction to this more advanced topic, to give you some ideas.
You can also use the word directions instead of procedure, but procedure is preferred because directions is a plural word for a single thing.
If you wanted to explain a complex procedure to your human intern, you might write it down in a step-by-step format. (Filling out a tax return is an example of a complex step-by-step procedure.) Synthia lets you do the same thing:
define a procedure to say the sign of a number.
if the number is greater than zero, say "it's positive". if the number is less than zero, say "it's negative".
if the number equals zero, say "it's zero". done.
This defines a 3-step procedure (step 1, step 2, step 3) that you can invoke with something like say the sign of 3-5.
Exercise: create a less redundant version using otherwise or return.
Synthia knows what’s happening in SynthEyes, so we can do some interesting things (here we use directions instead of procedure , just for illustration):
define the directions to name the clicked tracker a name. say the name string of the name. // necessary evil
wait for a selection change.
if the number of selected trackers does not equal one, say "please select only one tracker",
then go to step 2.
name the selected tracker the name. done.
define a procedure to name my favorite trackers. name the clicked tracker `TopLeft`.
name the clicked tracker `TopRight`. name the clicked tracker `BottomLeft`. name the clicked tracker `BottomRight`. done.
These two rules let you click on four trackers, one after another, and give them the listed name. This is a perfect way to name trackers on specific marks on a green
screen set, before importing their coordinates from a file. Or, you might set up a version that sets the coordinates of each trackers as part of the procedure.
Procedures can also produce specific results, such as a list of trackers or a frame number. To do that, include something like return the blue trackers in the procedure. There can be multiple return statements; in most cases they should all return one or more of the same nonterminal. The left-hand side nonterminal of the procedure's rule is adjusted correspondingly when you finish creating or editing the procedure.
Typically, you’d type up the whole procedure in Notepad or TextEdit, then Edit/Copy and paste it into Synthia’s input box with control-V (Win/Linux) or command-V (Mac). Whether you do that or simply type in the sentences to Synthia is up to you.
If you need to run a command while you are recording a procedure, you can do something like this:
immediately describe a tracker. immediately go to step 3.
The command will run immediately, instead of being stored in the procedure. (Compare this to " the current value of " in Defining Rules.)
You can edit the procedure to name my favorite trackers , then go to different steps and delete them, change them, or start recording to add additional steps. Say done editing and/or stop recording when you are done.
The currently-available rules for changing a procedure allow the step numbers embedded in a step to be changed, see rules about change. That should be comparatively rare since Synthia automatically renumbers step numbers as steps are added or deleted.
Exercise: add a center tracker to be clicked in the middle of the favorites.
Note the unlike programming languages, there are no "variable names" in Synthia procedures. You can refer to the tracker from step 3 or the cylinders from the last step , for example. This works for commands that you have entered as well (as listed in the Synthia window).
Exercise: define your own multi-step procedure.
Use find to retrieve some particular value that you can refer to later with the
from step n approach, as in
find the transform of the mesh. detach the mesh.
make the mesh’s transform the transform from step 1.
©2024 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.