Castle Game Engine: X3DFields: Class TX3DEvent

# Class TX3DEvent
Description | Hierarchy | Fields | Methods | Properties
## Unit X3DFields ## Declaration `type TX3DEvent = class(TX3DFieldOrEvent)` ## Description X3D event. ## Hierarchy TPersistent TNonRefCountedInterfacedPersistent TX3DFileItem TX3DFieldOrEvent TX3DEvent ## Overview ### Methods
| `constructor Create(AParentNode: TX3DFileItem; const AName: string; const AFieldClass: TX3DFieldClass; const AInEvent: boolean);`
| `destructor Destroy; override;`
| `procedure Parse(Lexer: TX3DLexer);`
| `procedure SaveToStream(Writer: TX3DWriter); override;`
| `function SaveToXml: TSaveToXmlMethod; override;`
| `procedure Send(Field: TX3DField; const Time: TX3DTime);`
| `procedure Send(Field: TX3DField);`
| `procedure Send(const Value: LongInt; const Time: TX3DTime);`
| `procedure Send(const Value: boolean; const Time: TX3DTime);`
| `procedure Send(const Value: string; const Time: TX3DTime);`
| `procedure Send(const Value: TVector2Single; const Time: TX3DTime);`
| `procedure Send(const Value: TVector3Single; const Time: TX3DTime);`
| `procedure Send(const Value: TVector4Single; const Time: TX3DTime);`
| `procedure Send(const Value: Single; const Time: TX3DTime);`
| `procedure Send(const Value: Double; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix3Single; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix4Single; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix3Double; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix4Double; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of string; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of TVector2Single; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of TVector3Single; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of TVector4Single; const Time: TX3DTime);`
| `procedure Send(const Value: LongInt);`
| `procedure Send(const Value: boolean);`
| `procedure Send(const Value: string);`
| `procedure Send(const Value: TVector2Single);`
| `procedure Send(const Value: TVector3Single);`
| `procedure Send(const Value: TVector4Single);`
| `procedure Send(const Value: Single);`
| `procedure Send(const Value: Double);`
| `procedure Send(const Value: TMatrix3Single);`
| `procedure Send(const Value: TMatrix4Single);`
| `procedure Send(const Value: TMatrix3Double);`
| `procedure Send(const Value: TMatrix4Double);`
| `procedure SendArray(const Value: array of string);`
| `procedure SendArray(const Value: array of TVector2Single);`
| `procedure SendArray(const Value: array of TVector3Single);`
| `procedure SendArray(const Value: array of TVector4Single);`
| `procedure RemoveHandler(Handler: TX3DEventReceive);`
| `function SendNeeded: boolean;`
| `procedure Assign(Source: TPersistent); override;`
### Properties
| `property FieldClass: TX3DFieldClass read FFieldClass;`
| `property InEvent: boolean read FInEvent;`
| `property ParentExposedField: TX3DField read FParentExposedField write FParentExposedField;`
| `property OnReceive: TX3DEventReceiveList read FOnReceive;`
## Description ### Methods
| `constructor Create(AParentNode: TX3DFileItem; const AName: string; const AFieldClass: TX3DFieldClass; const AInEvent: boolean);`
| `destructor Destroy; override;`
| `procedure Parse(Lexer: TX3DLexer);`
This only reads (optional) "IS" clause of the event, as may occur in VRML nodeBodyStatement.
| `procedure SaveToStream(Writer: TX3DWriter); override;`
| `function SaveToXml: TSaveToXmlMethod; override;`
| `procedure Send(Field: TX3DField; const Time: TX3DTime);`
Send a value to event. For input fields, this is used by routes, scripts etc. to send an event to a field. For output fields, this is used by node itself to send event to routes, scripts etc. Field must be non-nil, of class FieldClass. The Field instance doesn't become owned in any way by the TX3DEvent. That is, it's the caller responsibility to free the Field instance at any comfortable time, possibly right after calling Send. Overloaded versions without explicit Time parameter just take time from ParentNode.Scene.GetTime. If ParentNode is `Nil` (which should not happen with normal fields within nodes) or if ParentNode.Scene is `Nil` (which may happen only if events processing is not turned on, that is TCastleSceneCore.ProcessEvents is `False`) then event is not send.
| `procedure Send(Field: TX3DField);`
| `procedure Send(const Value: LongInt; const Time: TX3DTime);`
Send a value to event. See the Send(TX3DField, TX3DTime) method. These shortcuts just create temporary appropriate TX3DField instance, and call Send(TX3DField) method. The temporary field instance has Name initialized from this event Name, to ease debugging (you can see e.g. by Logger node the originating event name then). We have separate names for single-value and multiple-value fields (Send and SendArray), otherwise overloads could get confused (as vector is also just an array of floats, and matrix is just an array of vectors).
| `procedure Send(const Value: boolean; const Time: TX3DTime);`
| `procedure Send(const Value: string; const Time: TX3DTime);`
| `procedure Send(const Value: TVector2Single; const Time: TX3DTime);`
| `procedure Send(const Value: TVector3Single; const Time: TX3DTime);`
| `procedure Send(const Value: TVector4Single; const Time: TX3DTime);`
| `procedure Send(const Value: Single; const Time: TX3DTime);`
| `procedure Send(const Value: Double; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix3Single; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix4Single; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix3Double; const Time: TX3DTime);`
| `procedure Send(const Value: TMatrix4Double; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of string; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of TVector2Single; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of TVector3Single; const Time: TX3DTime);`
| `procedure SendArray(const Value: array of TVector4Single; const Time: TX3DTime);`
| `procedure Send(const Value: LongInt);`
| `procedure Send(const Value: boolean);`
| `procedure Send(const Value: string);`
| `procedure Send(const Value: TVector2Single);`
| `procedure Send(const Value: TVector3Single);`
| `procedure Send(const Value: TVector4Single);`
| `procedure Send(const Value: Single);`
| `procedure Send(const Value: Double);`
| `procedure Send(const Value: TMatrix3Single);`
| `procedure Send(const Value: TMatrix4Single);`
| `procedure Send(const Value: TMatrix3Double);`
| `procedure Send(const Value: TMatrix4Double);`
| `procedure SendArray(const Value: array of string);`
| `procedure SendArray(const Value: array of TVector2Single);`
| `procedure SendArray(const Value: array of TVector3Single);`
| `procedure SendArray(const Value: array of TVector4Single);`
| `procedure RemoveHandler(Handler: TX3DEventReceive);`
Safely remove a callback from OnReceive list. Contrary to direct `OnReceive.Remove` call, this works correctly even if we're right now in the middle of this event's processing. In the latter case, the handler will be actually removed with some delay (when it's safe).
| `function SendNeeded: boolean;`
Is anything actually listening on this events Send? Sometimes, even preparing a value to Send is quite time-consuming (example: CoordinateInterpolator, where a long MFVec3f value has to be computer). Then checking `SendNeeded` is useful: if `SendNeeded` = `False`, you know that there's no point in preparing Value to send, because actually Send will do nothing. For example, event out to which no ROUTE is connected, and no Script can listen to it. For now, this simply returns whether any OnReceive callback is registered.
| `procedure Assign(Source: TPersistent); override;`
Assign from another event. Note that FieldClass, InEvent is copied. OnReceive, ParentExposedField are not copied, since they shouldn't be copied so easily (ParentExposedField is related to hierarchy of containers, and OnReceive requires some knowledge of the caller when his callback is copied).
### Properties
| `property FieldClass: TX3DFieldClass read FFieldClass;`
| `property InEvent: boolean read FInEvent;`
Is it "in" or "out" event ?
| `property ParentExposedField: TX3DField read FParentExposedField write FParentExposedField;`
If this event is an exposed event belonging to some field, this references parent field. Otherwise it's `Nil`.
| `property OnReceive: TX3DEventReceiveList read FOnReceive;`
Notifications about receiving an item. For input fields, these are used by node itself to listen to events send to it. For output fields, these are used by routes, scripts to listen to events occuring. All callbacks here are simply called by Send method.
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:15