|
Introduction |
|
This tutorial will
show you the differences between the Expression Editor, Script
Editor, and History Window; as well as introduce you to the
use of TCL procedures.
This tutorial
requires:
Pixels3D
| studio | v3.x
|
The
Expression Editor |
|
The Expression Editor
evaluates the script it contains everytime the frame changes,
the user modifies the scene, or a redraw occurs.
This has a toggle
in the Scripts Menu. When Constant Script Evaluation is
on, the expressions are executed when specified above.
Selecting the menu
item again will turn it off, meaning no expressions will
be evaluated unlesss you choose Run All Now, in which
case they will be evaluated once.
|
|
The
Script Editor |
|
The Script Editor
only evaluates a script when the Run item is chosen from
the menu on the right of the window.
Note that the Script
Editor does not retain the script it holds when it is closed.
It is merely a temporary space to format & edit tcl scripts
without them being involuntarily executed before they're finished.
It has the ability
to set a Scene Script. A Scene Script is a script
that is evaluated only once - when the scene is opened. This
is useful for holding TCL procedures that would otherwise clutter
the Expression Editor.
|
|
The
History Window |
|
The History Window
is mostly self-explanatory. The PixelScript Syntax for everyt
action you perform appears in the top portion of the window.
The lower portion
of the window can be used as a TCL Console. Simply enter TCL
commands, and press the return key to execute them.
|
|
TCL
Procedures |
|
A TCL Procedure is
similar to a Function or Subroutine in other programming environments.
It is declared with
the proc command.
The example on the
right shows a simple TCL Procedure called SpinX. It spins
an object on the x axis at a user-defined speed.
There are two parameters
to the procedure - object, and speed. These are
specified in curly brackets following the procedure name.
Once the TCL procedure
has been evaluated, its functionality can be called by the procedure
name, followed by the parameters. The Expression on the right
uses the TCL procedure SpinX.
|
|
Use
a TCL Procedure for a Scene Script Activated by an Expression |
|
If we were to save
the scene with spinning objects, when we opened it again, the
objects would not spin, and there would be an error in the history
window.
This is because the
Procedure has not been added to the TCL command list. To make
this work, we'll use a Scene Script.
Create a Sphere.
Open both the Script
Editor ( CMD-2 ), and the Expression Editor ( CMD-1
).
|
|
| Enter
the code on the right into the appropriate windows. |
|
|
In the Script
Editor, choose Set Scene Script.
Save the Scene File.
The next time you
open the file, the TCL Procedure will execute, and the Expressions
using the Procedure will work.
The Get Scene
Script menu item allows you to retrieve & edit the Scene
Script.
|
|
The
End |
|
Now that you know
what should go where and why, the scripting
interface to Pixels should spark some ideas for your own scenes.
|
|