| Creating scripts with the 3DPI. |
Docs | Next |
The 3DPI offers 2 possibilities to get scriptlines:
- By clicking on the name of a property while keeping the
option key pressed (or on PC with the right mouse button).
- By working with the "Trace" Button (right
upper corner of the 3DPI window).
Because one can switch between 3 functions of the Trace Button,
all together there are 4 different possibilities for getting
scriptlines, depending on what you need:
- The script for setting one single property.
- The scripts for setting all properties, that are currently
visible within the 3DPI, at once.
- For advanced Lingo users property lists of all properties,
that are currently visible within the 3DPI.
- The scripts depending on the changes done with the 3DPI.
All scripts will appear in the message window, which can be
copied and pasted into a scriptmember of the movie for further
use.
|
| The script for one single Property |
top |
Getting the script for one single property is quite simple:
Click on the name of the property,
either while keeping the option key (= alt key) pressed, or
on PC with the right mouse button.
Open the message window, the scriptLine for this property did
appear.
Example:
Let´s say you would like to find the perfect lightning
situation for your scene, by only changing the default directional
light. You will select the Light-Tab of the 3DPI, select the
"UIDirectional" light, which by default is a light
of type #directional, and play around with its rotation by
dragging the handle in the bottom part of the 3DPI window.

After you found the perfect lightning situation, you now
would like to get the script for the rotation and its current
values to restore the lights rotation whenever you would like
to. Click on "rotation", the name of the property,
while keeping the option key pressed, or on PC by clicking
on it with the right mouse button.
Now take a look at the message window, where the scriptlines
did appear.

|
| Understanding the script |
top |
In the last example, the 3DPI has put 2 scriptlines into the
message window. Well in fact more lines did appear, but only
2 "real" scriptlines. Let´s have a look what
all the text, that appeared in the message window, means:
-- "*********** 3DPI Tracing ***********
This line is only there to help identifying, where the
last "3DPI Tracing" did start, in case your message
window is already full of scripts.
theLight = member(1, 1).light("UIDirectional")
This is the first "real" scriptline. Here a
reference to the light will be created, and it will be stored
within a variable called "theLight".
member(1, 1) is the reference to the shockwave3D
member.
In this example this member is placed in the first cast
slot, which in Lingo can be written as "member(1)"
or "member(1, 1)" or "(member 1 of castLib
1)".
light("UIDirectional") is the reference
to the light with the name 'UIDirectional'.
This scriptline is necessary to make the following line
working properly.
theLight.transform.rotation = vector(
-17.0576, 24.7340, 0.0000 )
This line, the second "real" scriptline, sets
the rotation of the light to the current values.
In Director a light (or any other Node) does not have its
own #rotation property, but a #transform property, which
keeps all informations about position, rotation and scale.
Normally one will rather work with the transform functions
"translate" and "rotate", but as this
example demonstrates, sometimes it is also useful to set
one of the transform properties directly. You have found
the perfect lightning situation, which in this case is the
rotation of the default direction light, and you would like
to recreate it with Lingo quickly.
The 2 scriptlines can now be copied and pasted into a scriptMember
of the movie.
|
| Testing the script in the message window |
top |
To understand the 2 created scriptlines a little better, the
most easiest way is to play with them directly in the message
window.
First of all you need to understand, that the scriptlines within
the message window are nothing but pure text and have "no
meaning" after they have been created by the 3DPI. To make
them working in the message window itself, it is necessary to
click at the end of each line and press the RETURN key.
Click behind the end of the first scriptline, which
creates a reference to the light, and press the RETURN
key.
This is the way how the message window itself gets to know
that the variable "theLight" is the reference to
the light.
If you forget to do so and try to work with the next scriptline
immediately, you would get a script error, because Director
would not know yet, what "theLlight" means.
Change the rotation of the light again by dragging
the handle in the bottom part of the 3DPI window.
Now click behind the end of the second scriptline
in the message window, which sets the rotation, and press
RETURN on the keyboard.
The light will be changed to the last situation again.
Change the values of the rotation within this scriptline,
e.g. to
theLight.transform.rotation
= vector( 50, 0.0000, -130)
click behind the end of the line and press RETURN.
The rotation of the light will change, the models will be
lightened from left above, and the rotation handle in the
bottom part of the 3DPI window appears on a left-upper placement
too.
|
| Getting more scripts with the Trace-Buttow |
top |
With the help of the 3DPIs Trace-Button you can get scripts
for all properties that are currently visible in the 3DPI, as
well as the scripts depending on the changes you do with the
3DPI.
Please read more information about the Trace-Button in the
chapter Trace-Button.
|
|