Castle Game Engine: X3DNodes: Class TX3DPrototypeNode

# Class TX3DPrototypeNode
Description | Hierarchy | Fields | Methods | Properties
## Unit X3DNodes ## Declaration `type TX3DPrototypeNode = class(TX3DNode)` ## Description Node with information about a VRML/X3D prototype. This node will have fields initialized according to associated Prototype.InterfaceDeclarations. This way you can simply parse this node (just like any other node) to parse prototype instance. The prototype may be instantiated. After parsing you can do it by Instantiate method. In case of non-external prototype, this should always be possible (for a valid VRML files, that is), in case of external prototype this may requite loading the external prototype file. This node cannot be created by standard Create method, always use CreatePrototypeNode. ## Hierarchy TPersistent TNonRefCountedInterfacedPersistent TX3DFileItem TX3DNode TX3DPrototypeNode ## Overview ### Methods
| `function DeepCopyCreate(CopyState: TX3DNodeDeepCopyState): TX3DNode; override;`
| `constructor Create(const ANodeName, ABaseUrl: string); override;`
| `constructor CreatePrototypeNode(const ANodeName, ABaseUrl: string; APrototype: TX3DPrototypeBase);`
| `function NodeTypeName: string; override;`
| `function Instantiate: TX3DNode;`
### Properties
| `property Prototype: TX3DPrototypeBase read FPrototype;`
## Description ### Methods
| `function DeepCopyCreate(CopyState: TX3DNodeDeepCopyState): TX3DNode; override;`
| `constructor Create(const ANodeName, ABaseUrl: string); override;`
This constructor will raise exception for TX3DPrototypeNode. Always use CreatePrototypeNode for this node class.
| `constructor CreatePrototypeNode(const ANodeName, ABaseUrl: string; APrototype: TX3DPrototypeBase);`
| `function NodeTypeName: string; override;`
| `function Instantiate: TX3DNode;`
Instantiate the prototype, that is create new VRML node (of "normal" classs, not TX3DPrototypeNode) using prototype description. For non-external prototype, in essense it just takes Prototype.Node and returns it's copy. For external prototype it first loads external file, and then uses non-external prototype there. Eventually, for external prototype we may also use build-in node (if URN will indicate so). Actually, the process is a little more involved (see below for details), but the idea is that returned node can be simply inserted into VRML hierarchy and works just like a normal node. The important feature is that returned instance class is the same that was specified as a first prototype node. For example, if the prototype should expand to Material node, then this returns TMaterialNode. Just like Material node would be normally specified, not created by some prototype. Note that this TX3DPrototypeNode becomes "owned" by returned node instance, in PrototypeInstanceSourceNode. (that's needed for returned node's SaveToStream to work correctly). Details: Prototype.Node may be just a wrapper, i.e. TX3DRootNode. In this case the first children of Prototype.Node is used to create instance. The rest of the wrapper (with this first children removed, to not cause cycles) is also duplicated and set as new node's PrototypeInstanceHelpers. Returned Node (with all it's helpers in PrototypeInstanceHelpers) has "IS" clauses everywhere filled, according to our field values. NodeName of returned node is copied from our NodeName. For SaveToStream to work, returned Node has PrototypeInstance = `True`, and PrototypeInstanceSourceNode set to Self. This allows SaveToStream to correctly save using PrototypeInstanceSourceNode, instead of writing actual node contents. ###### Exceptions raised EX3DPrototypeInstantiateError if for some reason the prototype cannot be instantiated. You can catch this and replace with OnWarning, if possible.
### Properties
| `property Prototype: TX3DPrototypeBase read FPrototype;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:17