Class TCasScriptX3DValueList

Unit

Declaration

type TCasScriptX3DValueList = class(TCasScriptValueList)

Description

No description available, ancestor TCasScriptValueList description follows

Hierarchy

Overview

Methods

Public constructor Create(AFreeObjects: boolean);
Public destructor Destroy; override;
Public procedure Add(FieldOrEvent: TX3DFieldOrEvent); reintroduce;
Public procedure BeforeExecute;
Public procedure AfterExecute(const Time: TX3DTime);
Public procedure ResetLastEventTimes;

Properties

Public property FieldOrEvents: TX3DFieldOrEventList read FFieldOrEvents;

Description

Methods

Public constructor Create(AFreeObjects: boolean);
 
Public destructor Destroy; override;
 
Public procedure Add(FieldOrEvent: TX3DFieldOrEvent); reintroduce;

Create TCasScriptValue descendant suitable to hold FieldOrEvent value, and add it to Items. FieldOrEvent is added to FieldOrEvents list, so we keep all information.

Public procedure BeforeExecute;
 
Public procedure AfterExecute(const Time: TX3DTime);
 
Public procedure ResetLastEventTimes;

Clear the memory when the last events were generated from this script. For each script output-capable field (inputOutput or outputOnly) on this list, we keep track of when it last generated an event.

This is needed to avoid loops.

Some background info why this is needed:

X3D spec says (4.4.8.3 Execution model): Nodes that contain output events shall produce at most one event per field per timestamp. [...] This also applies to scripts.

"[...]" above talks about ROUTE breaking rule, we handle this generally in TX3DRoute. The trouble with script is that it can make loops even without the help of ROUTEs: script receives it's inputs, and sends it's outputs, so when you send an output that causes your own input you made a loop... The most trivial example of this is when on receiving inputOutput you will set the very same inputOutput field, thus making a loop.

Scripts with directOutput (although not implemented yet) can cause even more trouble, as you can generate input event on another node that will get back to you. If two scripts generate events on each other, this can again make a loop, without the help of ROUTEs.

So we have to secure against this. This is done pretty much like with ROUTEs: we just remember the last timestamp, and ignore sending events again.

Properties

Public property FieldOrEvents: TX3DFieldOrEventList read FFieldOrEvents;

List of field/events associated with this list's CasScript variables. This list is read-only (use Add to add here). It always has the same Count as our own count.


Generated by PasDoc 0.16.0.