This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scripting.html
472 lines (236 loc) · 12.9 KB
/
scripting.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>scripting.html</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#f8e89e">
<font face="tahoma" size="2">
<div align="left"><a href="animation.html"><b><font size="4">Previous: Animation</font></b></a></div>
<div align="right"><a href="contents.html"><b><font size="4">Back to Contents</font></b></a></div>
<font face="tahoma" size="6"><strong>7. Scripting</strong></font>
<img src="man_title_small.jpg" align="middle"><br><br>
<br>
<br>
<br>
There are a wealth of possibilities available via the scripting feature which utilises the Groovy
and Beanshell scripting languages to allow you to program new objects, tools and many other features. The scripting
feature also allows use of the Art of Illusion methods and members found in the AoI source code.<br>
<br>
The scripting tools are located in the lower section of the <b>Tools</b> menu. A full description and
tutorial on the scripting feature is available on the documentation page of the main Art of Illusion
website (<a href="http://www.artofillusion.org">www.artofillusion.org</a>)<br>
<br>
There are 3 types of script:<br>
<br>
<a name="object_scripts"><strong><font color="#3300cc" size="5">7.1 Object Scripts</font></strong></a><br>
<br>
Object scripts create new types of objects ('scripted objects'). In this case, the script is continually
evaluated so that objects can have 'intelligence' in the way they react to, for example, position,
orientation or time.<br>
<br>
<table>
<tbody>
<tr>
<td width="400"><font face="tahoma" size="2">
To add an Object Script, select <b>Tools -> Create Scripted Object</b>. This displays the dialogue
shown on the right:<br>
<br>
At this point, you can give it a name by typing into the <b>Name</b> box.<br>
<br>
To create a new instance of an already written script, select the name of the script from the
<b>Script</b> drop down menu (AoI will automatically list any .bsh files that are
in the /Scripts/Objects folder) and click <b>OK</b>.
</font></td>
<td><img src="scripting/obj_script_dial1.jpg"></td>
</tr>
</tbody>
</table>
<br>
<br>
To write a new script, select New Script from the <b>Script</b> drop down menu and click <b>OK</b>.
This brings up the script editing window as shown below:<br>
<br>
<table>
<tbody>
<tr>
<td><img src="scripting/obj_script_dial2.png"></td>
<td width="400"><font face="tahoma" size="2">
Enter the lines of the script directly into the main part of the window or <b>Load</b> an existing
script into it. See the Scripting Tutorial for details of actual script programming.<br>
<br>
Click on <b>Save</b> to save the script. Ensure that it is saved into the /Scripts/Objects folder
so that AoI can find it.<br>
<br>
<b>Parameters</b> is a way of adding variables to a script which can be controlled outside of the
script via animation tracks. See the Scripting Tutorial for more details.
</font></td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<a name="tool_scripts"><strong><font color="#3300cc" size="5">7.2 Tool Scripts</font></strong></a><br>
<br>
Tool scripts are used to carry out a single action as they are only evaluated when invoked. Such
scripts, for instance, can create new objects within the scene or modify existing ones. Tool scripts can
also carry out actions on many other aspects like textures/materials and animation tracks.<br>
<br>
Existing Tool Scripts can be evoked by selecting <b>Tools -> Scripts</b> and then selecting
the appropriate script from the drop down list. This list contains all the Tool Scripts in the
/Scripts/Tools folder. Depending on the script, you may need to select at least one object before
running the script.<br>
<br>
To write a new Tool Script, select <b>Tools -> Edit Script</b>. This displays the tool script editor
which is similar to the Object Script editor described above. The difference is the <b>Execute</b>
command which runs the tool script.<br>
<br>
<br>
<a name="startup_scripts"><strong><font color="#3300cc" size="5">7.3 Startup Scripts</font></strong></a><br>
<br>
Startup scripts are a special sort of script that is executed every
time the program starts. Such scripts need to be stored in the Scripts/Startup folder. These scripts
can be used to configure AoI to maintain a certain layout each time it opens, to load a particular file
at startup etc.<br>
<br>
Startup scripts are created using the <b>Tools -> Edit Script</b> command. This displays the script
editor and scripts can be entered directly or loaded from disk. Use the <b>Save</b> command to save the
scripts into the Startup folder. See the Scripting Tutorial on the AoI web site for details of
actual script programming.<br>
<br>
One use of Startup Scripts is to set the Look and Feel of the interface which is possible on version
1.8 or later of AoI. Look and Feels can be downloaded from the internet (e.g. www.javootoo.com). In most
cases, you need to put the downloaded .jar file in your Java Runtime Environment (JRE)/lib/ext folder.
You then need to write a one-line Startup script as in the example below:<br>
<br>
UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");<br>
<br>
The part in quotes is the full path to the actual LookAndFeel class which will vary according to the look
and feel you are using. The documentation that comes with it should give the full path. Save the Startup
script with any name - it will then be executed at startup and your required look and feel will be loaded.<br>
<br>
<br>
<a name="SPManager"><strong><font color="#3300cc" size="5">7.4 Scripts and Plugins Manager</font></strong></a>
<font color="#3300cc">edited from text provided by Francois Guillet</font><br>
<br>
Note that this section of the manual contains only a section of the full documentation for this plugin -
full documentation is available <a href="http://francois.p.guillet.free.fr/">here</a>. This includes
information on the correct formatting of script comments etc. required by the Scripts and Plugins Manager.<br>
<br>
The Scripts and Plugins Manager allows you to manage the scripts and plugins installed in
the Art of Illusion folder. Using this tool, scripts and plugins can be installed,
updated or removed on the fly, without even relaunching AoI (Objects
and Tools scripts, not Startup scripts for obvious reasons !). Plugins
modification, however, requires that AoI is relaunched to work properly.<br>
<br>
To use the scripts and plugins manager, select <b>Tools -> Scripts & Plugins Manager</b>.
The following window appears :<br>
<br>
<img src="scripting/fig1.jpg"><br>
<br>
The tabbed pane on
the left side shows three tabs. The first one (<b>Manage</b>) allows browsing of
currently installed scripts and plugins. The second tab (<b>Update</b>) browses updates available at a remote
repository for these installed items. The third tab (<b>Install</b>) allows browsing of scripts and plugins
available at the same repository but that are not currently installed and are thus candidates for
installation. The remote repository scan for scripts and plugins begins
only when one of the two last tabs is selected.<br>
<br>
The pane at the right side of the window shows some information about
the currently selected object : name, author, version, etc... A
dropdown menu also allows other information to be displayed, e.g. other
files required and development history.<br>
<br>
The
<b>Delete plugin/script</b> button as shown on the picture allows the selected file to be deleted.
<b>Warning : do not delete vital AoI plugins (i.e.
Renderers, OSSpecific, Tools and Translators)</b>.
On some systems (Windows at least), it is not currently possible to delete a plugin
because it is being used by AoI. In this case, the manager will asks you to remove it
manually, i.e. delete the specified plugin file from the Plugins
directory. Quit and relaunch AoI after deletion.<br>
<br>
The buttons shown at the bottom of the pane depend on the tab currently
selected. This second picture shows the dialogue as it is when the <span style="font-weight: bold;">Install </span>tab is selected. When the <span style="font-weight: bold;">Update</span> tab is selected, the display is identical apart from the fact that 'Update' replaces 'Install' on relevant buttons.<br>
<br>
<img src="scripting/fig2.jpg"><br>
<br>
This time there are three buttons and a checkbox at the bottom of the pane. The <b>Selected</b>
checkbox allows the selection of a particular script or plugin for update. The <b>Select all</b>
button checks all the available items for update and is equivalent to manually checking all the
available scripts and plugins. All the checked scripts or plugins show
a checkmark over the relevant file icons. The <span style="font-weight: bold;">Install</span><b> this file</b> button immediately installs
the current item, whether it is selected or not. Finally, the <span style="font-weight: bold;">Install</span><b> all selected files</b> button
installs all selected files, i.e. the items that have a checked selected checkbox.<br>
<br>
The<span style="font-weight: bold;"> Update</span> tab works in exactly the same way as the <span style="font-weight: bold;">Install</span> tab. <br>
<br>
If scripts have been installed or updated, they are directly available in
AoI where they can be used. It is thus possible to install a plugin
that sounds interesting, test it and remove it if it turns out that the
script is not that interesting!<br>
<br>
The <b>Setup</b> button allows selection of the repository used to get remote files, as well as
specifying proxy information if you have to use a proxy.<br>
</font>
<table style="text-align: left; width: 1005px; height: 429px;" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 400px;"><font face="tahoma" size="2"><img src="scripting/fig3.jpg"></font></td>
<td><font face="tahoma" size="2">
The <b>Choose repository</b> dropdown
list allows the choice of the repository currently used. This allows the
selection of a backup repository in case the main repository is not
responding. The chosen repository is remembered the next time AoI is launched.
The Repositories list is updated each time AoI is launched or each time the <b>Rescan</b> button is clicked.
It is thus not necessary to manually update this list. If something goes wrong, though, you might have
to delete the file named .spmanagerprefs and use the URLs hard coded in the plugin.
This file is saved next to the AoI
preferences file. You might also want to manually add a URL to this
file (the format is straightforward). The <i>current</i> property must be set to the
number of the URL you add to the file. Be warned, though, that any
manual addition of a URL to this file is temporary since a fresh list
of repositories will be downloaded at next connection.<br>
<br>
<span style="font-weight: bold;">Filters</span> allow the seach to be tailored for particular types of script/plugin.<br>
<br>
The Proxy section makes it possible to use a proxy if access through a firewall is required.<br>
<br>
<b>Security Warning :
Passwords are saved encrypted. However, since the code for password
decryption is available in the source code, it is always possible for the code to be broken.
If you do not wish the password to be saved, you can enter a dummy password in the setup window before
quitting the manager.<br>
</b>
</font></td>
</tr>
</tbody>
</table>
<font face="tahoma" size="2"><br>
<br>
<br>
The <b>Rescan</b> button is for
rescanning the current repository for updates and installs.<br>
<br>
Finally, there is a status bar
at the bottom of the window. This status bar shows which URL is
contacted and what kind of information is downloaded. There are two
occasions on which the
Script and Plugins Manager contacts remote distant sites :<br>
<br>
<ul>
<li>when downloading an up-to-date repositories
list from Sourceforge in case the repositories list has changed.</li>
<br>
<li>when scanning a repository.</li>
</ul>
<b></b><br>
<br>
<br>
<div align="left"><a href="installation.html"><b><font size="4">Previous: Animation</font></b></a></div>
<br>
<a href="contents.html#contents_top"><b><font size="4">Back to Contents</font></b></a><br>
</font>
</body>
</html>