[x3d-public] Transform node which has a DEF used as MFNode?
Don Brutzman
brutzman at nps.edu
Fri Jul 1 17:04:37 PDT 2016
On 7/1/2016 10:55 AM, John Carlson wrote:
> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14-Prototypes/HudKelpForest.x3d has a ProtoDeclare field of hudGeometry which has type MFNode. The ProtoInstance field value points to a DEF which is a Transform. Is the transform an MFNode or an SFNode? I will assume that if a fieldValue has a value that is of MFNode type, then there is a DEF somewhere that refers to the value? Or does the MFNode type mean gather all DEFs and USEs and use them together as a parameter?
Whoa, great catch John. Pretty trick example.
The current source looks like
(a)
<ProtoInstance DEF='Hud' name='HUD'>
<fieldValue name='hudSize' value='1.5 .4 .1'/>
<fieldValue name='hudColor' value='1 1 0'/>
<fieldValue name='screenOffset' value='-.8 1. -3'/>
<fieldValue name='hudGeometry' value='HudContent'/>
</ProtoInstance>
I think that is probably incorrect. Expected form is
(b)
<ProtoInstance DEF='Hud' name='HUD'>
<fieldValue name='hudSize' value='1.5 .4 .1'/>
<fieldValue name='hudColor' value='1 1 0'/>
<fieldValue name='screenOffset' value='-.8 1. -3'/>
<fieldValue name='hudGeometry' value='HudContent'/>
<Transform USE='HudContent'/>
</fieldValue>
</ProtoInstance>
Unfortunately the X3D Schematron validation doesn't flag this as a problem. It probably should.
> I am not familiar with using DEF values as values for ProtoInstances, but I will try to implement the Prototype Expander that way.
I don't think we ever defined that functionality.
Looking at X3D Extensible Markup Language (XML) encoding, Clause 4 Concepts
http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html
and then
4.3.10 ProtoInstance and fieldValue statement syntax
http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#ProtoInstanceAndFieldValueStatement
=============================
The ProtoInstance element is used to create instances of nodes, which must be defined previously in the scene using either ProtoDeclare or ExternProtoDeclare statements.
ProtoInstance can contain zero or more fieldValue elements which are used to provide initial values for fields defined in the corresponding predecessor ProtoDeclare or ExternProtoDeclare statement. These fieldValue initializations are only used for field definitions with accesstype of initializeOnly or inputOutput and override any default values defined in the corresponding ProtoDeclare.
EXAMPLE
<Transform translation='0 -2.5 0'>
<Shape>
<Appearance>
<ProtoInstance name='EmissiveMaterial'>
<fieldValue name='onlyColor'
value='0.2 0.6 0.6'/>
</ProtoInstance>
</Appearance>
<Text string='"Prototype syntax" "examples"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
</Transform>
<ProtoInstance name='ViewPositionOrientation'>
<fieldValue name='enabled' value='true'/>
</ProtoInstance>
=============================
So there is no example given of a ProtoInstance fieldValue providing an SFNode/MFNode value. We should provide one. Form (b) above is legal by the rest of the X3D XML Encoding specification.
Since there is no definition of the shorthand for form (a) above, it isn't legal. I will create an X3D Schematron rule to detect and report it.
Since this shorthand in form (a) is pretty interesting, but can only represent a single SFNode USE name, and might be considered ambiguous, not sure we ought to allow it in a future version of the specification.
Might anyone like to make a case for (or against) form (a) as an allowed alternative approach in the X3D XML Encoding?
all the best, Don
--
Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
More information about the x3d-public
mailing list