Interface NodeTemplateToInstanceCreator
- All Known Implementing Classes:
CRProtoCreator
,NRProtoCreator
,OGLProtoCreator
The creator strips the definition apart and builds a runtime node based on the details and the node factory provided. The creator can handle one instance at a time, although it will correctly parse and build nested proto declarations without extra effort.
We have a small conundrum to deal with - if the proto definition contains SF/MFNode fields, we don't know whether the values should be also generated as real runtime nodes too. Maybe the usage of this node will provide values that are dealt with after this class has finished. Other times, these default values must be used. For this implementation, we have gone with the safety-first approach: Always parse the definition of any SF or MFNode field and turn those into runtime instances. Although this may create extra garbage, there seems to be no nice way of dealing with this issue without a completely different architecture for the library.
Note: Under the current implementation, EXTERNPROTOs are not yet catered for.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fillinInstance
(VRMLNodeTemplate template, VRMLNode nodeInstance, VRMLExecutionSpace space) Given a stubbed instance, fill in the rest of the details.newInstance
(VRMLNodeTemplate template, VRMLExecutionSpace root, int major, int minor, boolean staticNode) Build an instance of the node template from the given description.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the script code can be reported in a nice, pretty fashion.
-
Method Details
-
setErrorReporter
void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Parameters:
reporter
- The instance to use or null
-
newInstance
VRMLNode newInstance(VRMLNodeTemplate template, VRMLExecutionSpace root, int major, int minor, boolean staticNode) Build an instance of the node template from the given description.- Parameters:
template
- The source template to build nodes fromroot
- The execution space this node belongs inmajor
- The major version number of this sceneminor
- The minor version number of this scenestaticNode
- Whether this node is will be modified- Returns:
- A grouping node representing the body of the active node
-
fillinInstance
Given a stubbed instance, fill in the rest of the details. This is used for extern protos who create a light instance for the scene graph and then after the EP is loaded they fill in the details.- Parameters:
template
- The proto definition loaded from the EPnodeInstance
- The instance to fill outspace
- The execution space this node belongs in
-