@@ -263,11 +263,13 @@ Script {
263
263
inputOutput SFTime duration 10
264
264
url "ecmascript:
265
265
266
+ // Callback for 'inputOnly SFBool start'.
266
267
function start (value, time)
267
268
{
268
269
...
269
270
}
270
271
272
+ // Callback for 'inputOutput SFTime duration'.
271
273
function set_duration (value, time)
272
274
{
273
275
...
@@ -292,6 +294,7 @@ Script {
292
294
outputOnly SFFloat transparency_changed
293
295
url "ecmascript:
294
296
297
+ // Callback for 'inputOnly SFBool set_active'.
295
298
function set_active (value, time)
296
299
{
297
300
transparency_changed = value ? 0.5 : 0;
@@ -310,11 +313,13 @@ Script {
310
313
initializeOnly SFBool active
311
314
url "ecmascript:
312
315
316
+ // Callback for 'inputOnly SFBool set_active'.
313
317
function set_active (value, time)
314
318
{
315
319
active = value;
316
320
}
317
321
322
+ // Function to be called after all input fields are processed.
318
323
function eventsProcessed ()
319
324
{
320
325
print (active);
@@ -361,7 +366,7 @@ Sometimes it is necessary to get access to the corresponding Script node. For th
361
366
``` vrml
362
367
DEF Touch TouchSensor { }
363
368
364
- Script {
369
+ DEF SomeScript Script {
365
370
inputOnly SFBool set_active
366
371
initializeOnly SFNode touch USE Touch
367
372
url "ecmascript:
@@ -373,12 +378,13 @@ function initialize ()
373
378
// Add route from TouchSensor to this Script.
374
379
const scene = Browser .currentScene;
375
380
const route = scene .addRoute (touch, 'isActive', this, 'set_active');
376
- print (this .getNodeName ());
381
+ print (`initialize`, this .getNodeName ());
377
382
}
378
383
379
384
// Callback for 'inputOnly SFBool set_active'.
380
- function set_active (value, this )
385
+ function set_active (value, time )
381
386
{
387
+ print (`set_active`, this .getNodeName ());
382
388
// ...
383
389
}
384
390
"
0 commit comments