9
380 Chapter 12: Animation
time w ith the standard M AXScript var i able,
current Time. You can also reference scene
property values at other times by using "at
time" expressions in your scripts, as in regular
MAXScript programming.
Ass ign Nodes a nd Tra ck s to V ar i ab les
When you need to refer to nodes in your scene
or to anima tion tracks, it is recommended that
you use the Scr ipt controller variable toolset to
create variables to assign to any particular node or
controller track. This way, if you decide to later on
rename your scene objects, the scr ipt controllers
usingtheseobjectsarepreservedbecausethe
variables maintain the link to the nodes.
Otherwise, if you assign, for example, a node to
a variable manually in the dialog’s Expression
window, that link b ecomes broken as soon as you
rename that particular node.
Note: It is especially important to assign nodes and
tracks to variables with the corresponding buttons
when using XRef scenes and object s.
Procedure
To use a Transform S cript controller:
1.
Select an object.
2. Right-click to open the quad menu.
3. In Transform quadrant, click Curve Editor.
4. Select the Transform track of the selected object
in Track View.
5. Select Transform Script f rom the Assign
Transform Controller dialog and click OK.
The Script Controller dialog opens.
6. Editthematrix3valueintheScriptController
dialog, and click Evaluate w hen you are
finished.
Interfa ce
After assigning a Transform Scr ipt controller, a
Properties dialog is available by right-clicking the
track in the Track View hierarchy and choosing
Properties.
Cr e ate V aria b le g ro u p
Name—Lets you enter and edit the name of user
variables.
Cr e a te—Createsavariableandaddsittothe
Var i a b l e s l i s t .
Delete—Removes the highlighted v ariable from
the Variables list. You can also delete a variable by
tying its name into the Name field and click Delete.
Rename—Renames the highlighted variable.
Variable Parameters group
Tick Offset—Specifies a time offset in ticks for the
cur rent variable. When the script is evaluated, the
variable’s value is set from the current time plus
the Tick Offset value.
Note: The Time Offset has no effect on variables
that are assigned a constant.
Varia bles List—Lists all available variables in the
controller. The following pre-defined constant
variables are available in every script Controller
and can not be deleted or renamed:
•
F—the cur rent t ime in frames
•
NT—the normalized time
•
S—the current time in seconds
•
T—the current ti me in ticks