Class TSFNode
Unit
Declaration
type TSFNode = class(TX3DSingleField)
Description
X3D field holding a reference to a single node. It's defined in this unit, not in X3DFields, since it uses TX3DNode definition. NULL value of the field is indicated by Value field = nil.
Note that we store AllowedChildren list, which is a list of classes allowed as a Value (also nil is always allowed). But this is used only to produce warnings for a user. You should never assert that Value actually is one the requested classes. We want to keep here even not allowed items, because we want operation "read from VRML file + write to VRML file" to be as non-destructible as possible. So if user wrote invalid class hierarchy, we will output this invalid class hierarchy.
Source: scene/x3d/x3dnodes_sfnode.inc (line 36).
Hierarchy
- TObject
- TPersistent
- TX3DFileItem
- TX3DFieldOrEvent
- TX3DField
- TX3DSingleField
- TSFNode
Overview
Fields
| Public | OnInputIgnore: TInputIgnoreEvent; |
Methods
| Public | constructor Create; |
| Public | procedure SaveToStream(Writer: TX3DWriter); virtual; abstract; |
| Public | function SaveToXml: TSaveToXmlMethod; virtual; |
| Public | constructor Create(const AParentNode: TX3DFileItem; const AX3DName: string); |
| Public | destructor Destroy; override; |
| Public | function IsClauseNamesCount: Integer; |
| Public | procedure IsClauseNamesAssign(const SourceIsClauseNames: TCastleStringList); |
| Public | procedure IsClauseNamesAdd(const S: string); |
| Public | procedure ParseIsClause(Lexer: TX3DLexer); |
| Public | procedure AddAlternativeName(const AlternativeName: string; const X3DMajorVersion: Integer); virtual; |
| Public | procedure RemoveAlternativeName(const X3DMajorVersion: Integer); |
| Public | function IsName(const S: string): boolean; |
| Public | function NameForVersion(Version: TX3DVersion): string; overload; |
| Public | function NameForVersion(Writer: TX3DWriter): string; overload; |
| Public | function NiceName: string; |
| Public | procedure SaveToStreamClassicIsClauses(Writer: TX3DWriter); |
| Public | constructor CreateUndefined(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String); virtual; |
| Public | destructor Destroy; override; |
| Public | procedure Parse(Lexer: TX3DLexer; Reader: TX3DReader; IsClauseAllowed: boolean); |
| Public | procedure ParseValue(Lexer: TX3DLexer; Reader: TX3DReader); virtual; abstract; |
| Public | procedure ParseXMLAttributeLexer(Lexer: TX3DLexer; Reader: TX3DReader); virtual; |
| Public | procedure ParseXMLAttribute(const AttributeValue: String; Reader: TX3DReader); virtual; |
| Public | procedure ParseXMLElement(Element: TDOMElement; Reader: TX3DReader); virtual; |
| Public | procedure FieldSaveToStream(Writer: TX3DWriter; FieldSaveWhenDefault: boolean = false; XmlAvoidSavingNameBeforeValue: boolean = false); |
| Public | procedure SaveToStream(Writer: TX3DWriter); override; |
| Public | function SaveToXml: TSaveToXmlMethod; override; |
| Public | function EqualsDefaultValue: boolean; virtual; |
| Public | function Equals(SecondValue: TX3DField): boolean; reintroduce; virtual; |
| Public | function FastEqualsValue(SecondValue: TX3DField): boolean; virtual; |
| Public | function EventIn: TX3DEvent; |
| Public | function EventOut: TX3DEvent; |
| Public | class function X3DType: String; virtual; |
| Public | class function TypeName: String; deprecated 'use X3DType'; |
| Public | class function CreateEvent(const AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean): TX3DEvent; virtual; |
| Public | procedure AssignValue(Source: TX3DField); virtual; |
| Public | procedure AssignDefaultValueFromValue; virtual; |
| Public | procedure UnassignDefaultValue; virtual; |
| Public | procedure AssignLerp(const A: Double; Value1, Value2: TX3DField); virtual; |
| Public | function CanAssignLerp: boolean; virtual; |
| Public | procedure AddAlternativeName(const AlternativeName: String; const X3DMajorVersion: Integer); override; |
| Public | procedure Changed; |
| Public | function ExecuteChange: TX3DChange; virtual; |
| Public | procedure Send(Value: TX3DField); overload; |
| Public | procedure AddNotification(const Notification: TX3DEventReceive); |
| Public | procedure RemoveNotification(const Notification: TX3DEventReceive); |
| Public | constructor CreateUndefined(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String); override; |
| Public | constructor Create(const AParentNode: TX3DNode; const AExposed: boolean; const AName: String; const AAllowedChildrenClasses: array of TX3DNodeClass; const AValue: TX3DNode = nil); overload; |
| Public | constructor Create(const AParentNode: TX3DNode; const AExposed: boolean; const AName: String; const AAllowedChildrenClasses: TX3DNodeClassesList; const AValue: TX3DNode = nil); overload; |
| Public | constructor Create(const AParentNode: TX3DNode; const AExposed: boolean; const AName: String; const AnAllowedChildrenFunctionality: TNodeFunctionalityClass; const AValue: TX3DNode = nil); overload; |
| Public | destructor Destroy; override; |
| Public | procedure ParseValue(Lexer: TX3DLexer; Reader: TX3DReader); override; |
| Public | procedure ParseXMLAttribute(const AttributeValue: String; Reader: TX3DReader); override; |
| Public | procedure ParseXMLElement(Element: TDOMElement; Reader: TX3DReader); override; |
| Public | function EqualsDefaultValue: boolean; override; |
| Public | function Equals(SecondValue: TX3DField): boolean; override; |
| Public | procedure Assign(Source: TPersistent); override; |
| Public | procedure AssignValue(Source: TX3DField); override; |
| Public | procedure AssignDefaultValueFromValue; override; |
| Public | procedure UnassignDefaultValue; override; |
| Public | class function X3DType: String; override; |
| Public | class function CreateEvent(const AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean): TX3DEvent; override; |
| Public | procedure WarningIfChildNotAllowed(Child: TX3DNode); |
| Public | function ChildAllowed(Child: TX3DNode): boolean; |
| Public | function CurrentChildAllowed: boolean; |
| Public | function Enumerate(Func: TEnumerateChildrenFunction): Pointer; |
| Public | procedure Send(const AValue: TX3DNode); overload; |
Properties
| Public | property PositionInParent: Integer
read FPositionInParent write FPositionInParent default -1; |
| Public | property X3DName: string read FX3DName; |
| Public | property Name: string read FX3DName; deprecated 'use X3DName'; |
| Public | property ParentNode: TX3DFileItem read FParentNode write FParentNode; |
| Public | property IsClauseNames[const Index: Integer]: string read GetIsClauseNames; |
| Public | property ParentInterfaceDeclaration: TX3DFileItem
read FParentInterfaceDeclaration write FParentInterfaceDeclaration; |
| Public | property ValueFromIsClause: boolean
read FValueFromIsClause write FValueFromIsClause; |
| Public | property Exposed: boolean read FExposed write SetExposed default false; |
| Public | property ExposedEvents [InEvent: boolean]: TX3DEvent
read GetExposedEvents; |
| Public | property ExposedEventsLinked: boolean
read FExposedEventsLinked write SetExposedEventsLinked
default true; |
| Public | property ChangeAlways: TX3DChange read FChangeAlways write FChangeAlways default chNone; |
| Public | property DefaultValue: TX3DNode
read FDefaultValue write SetDefaultValue; |
| Public | property DefaultValueExists: boolean
read FDefaultValueExists write SetDefaultValueExists default false; |
| Public | property Value: TX3DNode read FValue write SetValue; |
| Public | property ParentNode: TX3DNode read FParentNode; |
| Public | property WeakLink: boolean
read FWeakLink write SetWeakLink default false; |
| Public | property AutomaticWeakLink: Boolean
read FAutomaticWeakLink write FAutomaticWeakLink default false; |
| Public | property OnBeforeValueChange: TNodeChangeEvent
read FOnBeforeValueChange write FOnBeforeValueChange; |
Description
Fields
| Public | OnInputIgnore: TInputIgnoreEvent; |
|
This item has no description. | |
Methods
| Public | constructor Create; |
|
This item has no description. | |
| Public | procedure SaveToStream(Writer: TX3DWriter); virtual; abstract; |
|
Save to stream. | |
| Public | function SaveToXml: TSaveToXmlMethod; virtual; |
|
How is this saved to X3D XML encoding. This determines when SaveToStream is called. It also cooperates with some SaveToStream implementations, guiding how the item is actually saved. By default it is sxChildElement. | |
| Public | constructor Create(const AParentNode: TX3DFileItem; const AX3DName: string); |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 47). | |
| Public | destructor Destroy; override; |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 48). | |
| Public | function IsClauseNamesCount: Integer; |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 102). | |
| Public | procedure IsClauseNamesAssign(const SourceIsClauseNames: TCastleStringList); |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 103). | |
| Public | procedure IsClauseNamesAdd(const S: string); |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 104). | |
| Public | procedure ParseIsClause(Lexer: TX3DLexer); |
|
Parse only "IS" clause, if it's not present — don't do nothing. For example, for the TX3DField descendant, this does not try to parse field value. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 110). | |
| Public | procedure AddAlternativeName(const AlternativeName: string; const X3DMajorVersion: Integer); virtual; |
|
Add alternative name for the same field/event, to be used in different VRML version. When VRML major version is exactly equal X3DMajorVersion, the AlternativeName should be used — for both reading and writing of this field/event. In some cases, when reading, we may also allow all versions (both original and alternative), but this is mostly for implementation simplicity — don't count on it. A special value 0 for X3DMajorVersion means that this is just an alternative name, that should be allowed when reading (as alternative to normal Name), and never used when writing. Alternative names is a very handy mechanism for cases when the only thing that changed between VRML versions is the field name. Example: Switch node's children/choice, LOD node's children/level, Polyline2D lineSegments/point. Note that this also works for ExposedEvents with exposed TX3DField: if a field has alternative names, then it's exposed events always also have appropriate alternative names. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 133). | |
| Public | procedure RemoveAlternativeName(const X3DMajorVersion: Integer); |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 135). | |
| Public | function IsName(const S: string): boolean; |
|
Returns if S matches current Name or one of the alternative names. Think about it like simple test "Name = S", but actually this checks also names added by AddAlternativeName method. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 140). | |
| Public | function NameForVersion(Version: TX3DVersion): string; overload; |
|
Return how this field should be named for given VRML version. In almost all cases, this simply returns current Name. But it can also return a name added by AddAlternativeName method. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 145). | |
| Public | function NameForVersion(Writer: TX3DWriter): string; overload; |
|
This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 146). | |
| Public | function NiceName: string; |
|
Nice and concise field description for user. Describes parent node type, name and field/event's name. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 159). | |
| Public | procedure SaveToStreamClassicIsClauses(Writer: TX3DWriter); |
|
Save IS clauses to stream, only for classic encoding. For each IS clause, writeln field/event name followed by "IS" clause. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 163). | |
| Public | constructor CreateUndefined(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String); virtual; |
|
Main constructor that initializes field when default value is not known. It is virtual, so you can use it to construct field instance when field class is known only at runtime. For example you can have variable like "FieldClass: TX3DFieldClass" and use it to construct the field instance. Such field can be later initialized e.g. using Parse. Note: Two exceptional VRML 1.0 fields simply cannot work when initialized by this constructor: TSFEnum and TSFBitMask . They simply need to know their TSFEnum.EnumNames, or TSFBitMask.FlagNames + TSFBitMask.NoneString + TSFBitMask.AllString before they can be parsed. Luckily these fields have been removed in VRML 2.0 and X3D so we don't need to support them e.g. in VRML 2.0 and X3D prototypes. Descendants implementors: 1. Descendants should override this virtual constructor, Call "inherited" at the beginning of the implementation of this overridden " 2. Can Create also a convenience non-virtual constructor Create, that takes as parameter initial value (with type specific to given field, e.g. Integer for TSFInt32). This convenience constructor should call " TODO: Rename this to just Create, to obscure parent Create. After everything migrated to calling | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | procedure Parse(Lexer: TX3DLexer; Reader: TX3DReader; IsClauseAllowed: boolean); |
|
Parse inits properties from Lexer. In this class, Parse only appends to IsClauseNames: if we stand on "IS" clause (see VRML 2.0 spec about "IS" clause) and IsClauseAllowed then we append specified identifier to IsClauseNames. If "IS" clause not found, we call ParseValue which should actually parse field's value. Descendants should override ParseValue. | |
| Public | procedure ParseValue(Lexer: TX3DLexer; Reader: TX3DReader); virtual; abstract; |
|
This item has no description. | |
| Public | procedure ParseXMLAttributeLexer(Lexer: TX3DLexer; Reader: TX3DReader); virtual; |
|
Parse field value from X3D XML encoded attribute using a Lexer. Attributes in X3D are generally encoded such that normal | |
| Public | procedure ParseXMLAttribute(const AttributeValue: String; Reader: TX3DReader); virtual; |
|
Parse field value from X3D XML encoded attribute. Implementation in this class creates a Lexer to parse the string, and calls ParseXMLAttributeLexer. | |
| Public | procedure ParseXMLElement(Element: TDOMElement; Reader: TX3DReader); virtual; |
|
Parse field's value from XML Element children. This is used to read SFNode / MFNode field value inside <field> (for interface declaration default field value) and <fieldValue> inside <ProtoInstance>. | |
| Public | procedure FieldSaveToStream(Writer: TX3DWriter; FieldSaveWhenDefault: boolean = false; XmlAvoidSavingNameBeforeValue: boolean = false); |
|
Save the field to the stream. Field name (if set, omitted if empty) and value are saved. Unless the current field value equals default value and FieldSaveWhenDefault is IS clauses are not saved here (because they often have to be treated specially anyway, for XML encoding, for prototype declarations etc.). | |
| Public | procedure SaveToStream(Writer: TX3DWriter); override; |
|
Save the field to the stream. This simply calls FieldSaveToStream(Writer). See FieldSaveToStream for more comments and when you need control over FieldSaveWhenDefault behavior. It doesn't actually save anything if field value is defined and equals default value. | |
| Public | function SaveToXml: TSaveToXmlMethod; override; |
|
This item has no description. Showing description inherited from TX3DFileItem.SaveToXml. How is this saved to X3D XML encoding. This determines when SaveToStream is called. It also cooperates with some SaveToStream implementations, guiding how the item is actually saved. By default it is sxChildElement. | |
| Public | function EqualsDefaultValue: boolean; virtual; |
|
Whether the value is equal to default. Returns always | |
| Public | function Equals(SecondValue: TX3DField): boolean; reintroduce; virtual; |
|
All descendants (that add some property that should be compared) should override this like Result := (inherited Equals(SecondValue)) and (SecondValue is TMyType) and (TMyType(SecondValue).MyProperty = MyProperty);
The floating-point fields may be compared with a small epsilon tolerance by this method. Note that this *doesn't* compare the default values of two fields instances. This compares only the current values of two fields instances, and eventually some other properties that affect parsing (like names for TSFEnum and TSFBitMask) or allowed future values (like TSFFloat.MustBeNonnegative). | |
| Public | function FastEqualsValue(SecondValue: TX3DField): boolean; virtual; |
|
Compare value of this field, with other field, fast. This compares only the values of the fields, not other properties (it doesn't care about names of the fields or such, or default values; only current values). In other words, it compares only the things copied by AssignValue. This tries to compare very fast, which means that for large (multi-valued) fields it may give up and answer Default implementation in this class ( | |
| Public | function EventIn: TX3DEvent; |
|
Exposed events of this field. | |
| Public | function EventOut: TX3DEvent; |
|
This item has no description. | |
| Public | class function X3DType: String; virtual; |
|
Field type in X3D, like | |
| Public | class function TypeName: String; deprecated 'use X3DType'; |
|
Warning: this symbol is deprecated: use X3DType This item has no description. | |
| Public | class function CreateEvent(const AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean): TX3DEvent; virtual; |
|
Create TX3DEvent descendant suitable as exposed event for this field. | |
| Public | procedure AssignValue(Source: TX3DField); virtual; |
|
Copies the current field value. Contrary to TPersistent.Assign, this doesn't copy the rest of properties. After setting, our ValueFromIsClause is always changed to
Descendants implementors notes: In this class, implementation takes care of setting our ValueFromIsClause to if Source is <appropriate class> then begin inherited; Value := Source.value; end else AssignValueRaiseInvalidClass(Source); Exceptions raised
| |
| Public | procedure AssignDefaultValueFromValue; virtual; |
|
Set field's default value from the current value. Note that for now this doesn't guarantee that every possible field's value can be stored as default value. In case of trouble, it will silently record "no default is known" information, so e.g. EqualsDefaultValue will always return | |
| Public | procedure UnassignDefaultValue; virtual; |
|
Remove default value, recording that "no default is known". In effect EqualsDefaultValue will always return | |
| Public | procedure AssignLerp(const A: Double; Value1, Value2: TX3DField); virtual; |
|
Assigns value to this node calculated from linear interpolation between two given nodes Value1, Value2. Just like other lerp functions in our units (like CastleVectors.Lerp). Like AssignValue, this copies only the current value. All other properties (like Name, IsClauseNames, ValueFromIsClause, default value) are untouched. There are some special precautions for this:
Exceptions raised
| |
| Public | function CanAssignLerp: boolean; virtual; |
|
Is AssignLerp usable on this field type?
Descendants implementors notes: In this class, this always returns | |
| Public | procedure AddAlternativeName(const AlternativeName: String; const X3DMajorVersion: Integer); override; |
|
This item has no description. Showing description inherited from TX3DFieldOrEvent.AddAlternativeName. Add alternative name for the same field/event, to be used in different VRML version. When VRML major version is exactly equal X3DMajorVersion, the AlternativeName should be used — for both reading and writing of this field/event. In some cases, when reading, we may also allow all versions (both original and alternative), but this is mostly for implementation simplicity — don't count on it. A special value 0 for X3DMajorVersion means that this is just an alternative name, that should be allowed when reading (as alternative to normal Name), and never used when writing. Alternative names is a very handy mechanism for cases when the only thing that changed between VRML versions is the field name. Example: Switch node's children/choice, LOD node's children/level, Polyline2D lineSegments/point. Note that this also works for ExposedEvents with exposed TX3DField: if a field has alternative names, then it's exposed events always also have appropriate alternative names. | |
| Public | procedure Changed; |
|
Notify ParentNode.Scene that the value of this field changed. | |
| Public | function ExecuteChange: TX3DChange; virtual; |
|
What happens when the value of this field changes. This is called, exactly once, by TCastleSceneCore.InternalChangedField to determine what must be done when we know that value of this field changed. In overridden descendants, this can also do something immediately. Overriding this is similar to registering your callback by EventOut.AddNotification, with two additional benefits:
So overridding this is closer to "do something when field value changes" than registering notification by EventOut.AddNotification. | |
| Public | procedure Send(Value: TX3DField); overload; |
|
Set the value of the field, notifying the scenes and events engine. This sets the value of this field in the nicest possible way for any possible TCastleSceneCore (with events on or off) containing the node with this field. Precise specification:
| |
| Public | procedure AddNotification(const Notification: TX3DEventReceive); |
|
Notifications when exposed field received new value through VRML/X3D event. Use only for exposed fields. This is simply a shortcut for Note that this observes the "out" event (not the "in" event). This way you know inside the handler that the field value is already changed as appropriate. Inside "in" event handlers, you would not know this (it would depend on the order in which handlers are run, one "in" handler sets the field value). Note that "out" event handlers are executed before Scene is notified about the field value change (before TCastleSceneCore.InternalChangedField is called). This is also usually exactly what you want — you can change the scene graph inside the event handler (for example, load something on Inline.load or Inline.url changes), and let the TX3DField.ChangeAlways cause appropriate action on this change. | |
| Public | procedure RemoveNotification(const Notification: TX3DEventReceive); |
|
This item has no description. | |
| Public | constructor CreateUndefined(const AParentNode: TX3DFileItem; const AExposed: boolean; const AName: String); override; |
|
Construct a field allowing any children class. Suitable only for special cases. For example, in instantiated prototypes, we must initially just allow all children, otherwise valid prototypes with SFNode/MFNode would cause warnings when parsing. | |
| Public | constructor Create(const AParentNode: TX3DNode; const AExposed: boolean; const AName: String; const AAllowedChildrenClasses: array of TX3DNodeClass; const AValue: TX3DNode = nil); overload; |
|
This item has no description. | |
| Public | constructor Create(const AParentNode: TX3DNode; const AExposed: boolean; const AName: String; const AAllowedChildrenClasses: TX3DNodeClassesList; const AValue: TX3DNode = nil); overload; |
|
Constructor that takes a list of allowed children classes. Note that we copy the contents of AAllowedChildrenClasses, not the reference. | |
| Public | constructor Create(const AParentNode: TX3DNode; const AExposed: boolean; const AName: String; const AnAllowedChildrenFunctionality: TNodeFunctionalityClass; const AValue: TX3DNode = nil); overload; |
|
Constructor that allows as children any implementor of given functionality. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | procedure ParseValue(Lexer: TX3DLexer; Reader: TX3DReader); override; |
|
This item has no description. | |
| Public | procedure ParseXMLAttribute(const AttributeValue: String; Reader: TX3DReader); override; |
|
This item has no description. Showing description inherited from TX3DField.ParseXMLAttribute. Parse field value from X3D XML encoded attribute. Implementation in this class creates a Lexer to parse the string, and calls ParseXMLAttributeLexer. | |
| Public | procedure ParseXMLElement(Element: TDOMElement; Reader: TX3DReader); override; |
|
This item has no description. Showing description inherited from TX3DField.ParseXMLElement. Parse field's value from XML Element children. This is used to read SFNode / MFNode field value inside <field> (for interface declaration default field value) and <fieldValue> inside <ProtoInstance>. | |
| Public | function EqualsDefaultValue: boolean; override; |
|
This item has no description. Showing description inherited from TX3DField.EqualsDefaultValue.
Whether the value is equal to default. Returns always | |
| Public | function Equals(SecondValue: TX3DField): boolean; override; |
|
This item has no description. Showing description inherited from TX3DField.Equals.
All descendants (that add some property that should be compared) should override this like Result := (inherited Equals(SecondValue)) and (SecondValue is TMyType) and (TMyType(SecondValue).MyProperty = MyProperty);
The floating-point fields may be compared with a small epsilon tolerance by this method. Note that this *doesn't* compare the default values of two fields instances. This compares only the current values of two fields instances, and eventually some other properties that affect parsing (like names for TSFEnum and TSFBitMask) or allowed future values (like TSFFloat.MustBeNonnegative). | |
| Public | procedure Assign(Source: TPersistent); override; |
|
This item has no description. | |
| Public | procedure AssignValue(Source: TX3DField); override; |
|
This item has no description. Showing description inherited from TX3DField.AssignValue. Copies the current field value. Contrary to TPersistent.Assign, this doesn't copy the rest of properties. After setting, our ValueFromIsClause is always changed to
Descendants implementors notes: In this class, implementation takes care of setting our ValueFromIsClause to if Source is <appropriate class> then begin inherited; Value := Source.value; end else AssignValueRaiseInvalidClass(Source); | |
| Public | procedure AssignDefaultValueFromValue; override; |
|
This item has no description. Showing description inherited from TX3DField.AssignDefaultValueFromValue. Set field's default value from the current value. Note that for now this doesn't guarantee that every possible field's value can be stored as default value. In case of trouble, it will silently record "no default is known" information, so e.g. EqualsDefaultValue will always return | |
| Public | procedure UnassignDefaultValue; override; |
|
This item has no description. Showing description inherited from TX3DField.UnassignDefaultValue.
Remove default value, recording that "no default is known". In effect EqualsDefaultValue will always return | |
| Public | class function X3DType: String; override; |
|
This item has no description. Showing description inherited from TX3DField.X3DType.
Field type in X3D, like | |
| Public | class function CreateEvent(const AParentNode: TX3DFileItem; const AName: String; const AInEvent: boolean): TX3DEvent; override; |
|
This item has no description. Showing description inherited from TX3DField.CreateEvent. Create TX3DEvent descendant suitable as exposed event for this field. | |
| Public | procedure WarningIfChildNotAllowed(Child: TX3DNode); |
|
Checks is the Child allowed as a value of this SFNode, and makes WritelnWarning if not. Check is allowed is done looking at AllowedChildrenAll and AllowedChildren properties. Child must not be WritelnWarning message will suggest that this Child is used as value of this node. In other words, you should only pass as Child a node that you want to assign as Value to this field, otherwise WritelnWarning message will be a little unsensible. | |
| Public | function ChildAllowed(Child: TX3DNode): boolean; |
|
This item has no description. | |
| Public | function CurrentChildAllowed: boolean; |
|
This item has no description. | |
| Public | function Enumerate(Func: TEnumerateChildrenFunction): Pointer; |
|
Calls Func for our Value, assuming it's set (non-nil). The main use for this is to simplify implementation of TX3DNode.DirectEnumerateActive overrides in TX3DNode descendants. | |
| Public | procedure Send(const AValue: TX3DNode); overload; |
|
This item has no description. | |
Properties
| Public | property PositionInParent: Integer
read FPositionInParent write FPositionInParent default -1; |
|
Position of this item within parent VRML/X3D node, used for saving the VRML/X3D graph to file. Default value -1 means "undefined". For normal usage and processing of VRML graph, this is totally not needed. This position doesn't dictate actual meaning of VRML graph. If you're looking to change order of nodes, you probably want to rather look at something like ReplaceItems within TMFNode or such. This field is purely a hint when encoding VRML file how to order VRML items (nodes, fields, routes, protos) within parent node or the VRML file. Reason: VRML allows non-unique node names. Each DEF XXX overrides all previous ("previous" in lexical sense, i.e. normal order of tokens in the file) DEF XXX with the same XXX, thus hiding previous node name "XXX". This means that when saving VRML file we have to be very careful about the order of items, such that e.g. all routes are specified when appropriate node names are bound. This is a relative position, relative to other See e.g. ../../../demo_models/x3d/tricky_def_use.x3dv for tests of some tricky layout. When reading such file we have to record | |
| Public | property X3DName: string read FX3DName; |
|
Name of the field or event. Most fields/events are inside some X3D node, and then they have a non-empty name. But in some special cases we also use temporary fields with an empty name. Note that you cannot change this after object creation, since Name is used for various purposes (like to generate names for TX3DField.ExposedEvents). Note that this property is deliberately not called Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 67). | |
| Public | property Name: string read FX3DName; deprecated 'use X3DName'; |
|
Warning: this symbol is deprecated: use X3DName This item has no description. Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 68). | |
| Public | property ParentNode: TX3DFileItem read FParentNode write FParentNode; |
|
X3D node containing this field/event. This must always contain an instance of TX3DNode class (although it cannot be declared such, since X3DFields unit cannot depend on X3DNodes interface). It may be Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 76). | |
| Public | property IsClauseNames[const Index: Integer]: string read GetIsClauseNames; |
|
"IS" clauses of this field/event, used when this field/event is inside prototype definition. This is an array, as one item may have many "IS" clauses (for a field, only one "IS" clause should refer to another field; but you can have many "IS" clauses connecting events, also exposedField may have "IS" clause that should be interpreted actually as links to it's exposed events). See e.g. Note that having "IS" clauses doesn't mean that the field should be considered "without any value". This is not a good way of thinking, as an exposed field may have an "IS" clause, but linking it to an event, and thus such field has it's value (default value, if not specified in the file), event though it also has an "IS" clause. Although there is TX3DField.ValueFromIsClause, which indicates whether current value was obtained from "IS" clause. To be able to significantly optimize memory, we do not expose Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 101). | |
| Public | property ParentInterfaceDeclaration: TX3DFileItem
read FParentInterfaceDeclaration write FParentInterfaceDeclaration; |
|
For fields contained in TX3DInterfaceDeclaration. This should always be Source: scene/x3d/castlefields_x3dfieldorevent.inc (line 154). | |
| Public | property ValueFromIsClause: boolean
read FValueFromIsClause write FValueFromIsClause; |
|
Does current field value came from expanding "IS" clause. If yes, then saving this field to stream will only save it's "IS" clauses, never saving actual value. | |
| Public | property Exposed: boolean read FExposed write SetExposed default false; |
|
Does this field generate/accept events, that is an "exposedField" (in VRML 2.0) or "inputOutput" (in X3D). | |
| Public | property ExposedEvents [InEvent: boolean]: TX3DEvent
read GetExposedEvents; |
|
These are the set_xxx and xxx_changed events exposed by this field. | |
| Public | property ExposedEventsLinked: boolean
read FExposedEventsLinked write SetExposedEventsLinked
default true; |
|
When You almost certainly want to leave this as That said, in special cases you may decide to break this. | |
| Public | property ChangeAlways: TX3DChange read FChangeAlways write FChangeAlways default chNone; |
|
What always happens when the value of this field changes. This is included in the ExecuteChange method result. So instead of using this property, you could always override ExecuteChange method. But often it's easier to use the property. By default this is chNone. See TX3DChange for possible values. | |
| Public | property DefaultValue: TX3DNode
read FDefaultValue write SetDefaultValue; |
|
Default value of SFNode field. While X3D specification says for all SFNode fields that their default value is NULL, this is not necessarily true for PROTO SFNode fiels. So we have to take into account that any Note that this doesn't have to be Freeing of this is automatically managed, just like the normal Value property. This means that you can simply set | |
| Public | property DefaultValueExists: boolean
read FDefaultValueExists write SetDefaultValueExists default false; |
|
This item has no description. | |
| Public | property Value: TX3DNode read FValue write SetValue; |
|
This item has no description. | |
| Public | property ParentNode: TX3DNode read FParentNode; |
|
VRML node containing this field. May be Note that this property is exactly the same as TX3DFieldOrEvent.ParentNode, contains always the same value. But this is declared as TX3DNode, so it's more comfortable. | |
| Public | property WeakLink: boolean
read FWeakLink write SetWeakLink default false; |
|
Use weak links to deal with cycles in the X3D graph. Marking a field as a weak link can only be done when the field value is empty, right when the field is created, in TX3DNode.CreateNode descendant. Being a weak link means two things:
If effect, this avoids loops when enumerating (and avoids recursive loops in reference counts, which would cause memory leaks), but use this only when you know that the node must occur somewhere else in the X3D graph anyway (or it's OK to ignore it). For example, this is useful for TGeneratedShadowMapNode.Light, as we know that the light must occur somewhere else in the graph anyway to be useful. | |
| Public | property AutomaticWeakLink: Boolean
read FAutomaticWeakLink write FAutomaticWeakLink default false; |
|
Automatically use WeakLink if field would contain a node cycle. Using WeakLink=true allows to handle node cycles, like common in VRML/X3D
DEF Xxx Transform {
children [
...
Script {
...
inputOutput SFNode someField USE Xxx
}
]
}
When Use this only for fields that are not enumerated by DirectEnumerateActive, Traverse etc., otherwise you create a cycle in nodes that we generally cannot handle. | |
| Public | property OnBeforeValueChange: TNodeChangeEvent
read FOnBeforeValueChange write FOnBeforeValueChange; |
|
Called when Value changes. Called before the change is actually done, right after we know that new value is different than old value. | |
Generated by PasDoc 0.17.0.snapshot.