[x3d-public] setUSE in X3DJSAIL. Impact on X3DJSONLD.
John Carlson
yottzumm at gmail.com
Fri Jul 21 13:33:29 PDT 2017
Why do we need both DEF and USE? Why can’t we combine them and just accept that the last attribute/attribute value that gets set is the correct one?
Is it for human understanding?
John
Sent from Mail for Windows 10
From: Andreas Plesch
Sent: Friday, July 21, 2017 4:08 PM
To: Don Brutzman
Cc: John Carlson; X3D Graphics public mailing list
Subject: Re: [x3d-public] setUSE in X3DJSAIL. Impact on X3DJSONLD.
Thanks. Not sure if importDocument would be very relevant outside of a web browser but it could be, especially if transpiled to JS.
Looking back at setUSE, I do not think one can modify an already existing USE reference with SAI. Instead, get a node (with its DEF name), http://www.web3d.org/documents/specifications/19777-2/V3.3/Part2/functions.html#getNode, and insert it with field.setValue, http://www.web3d.org/documents/specifications/19777-2/V3.3/Part2/functions.html#setValue, overwriting an existing reference.
One does the same for the initial construction of the scene. First, create a node with a DEF name, then use it to set the field values where ever it is used:
Instead of
nodetype.setUSE('defName')
it becomes
field.setValue(scene.getNode('defName'))
I think one could follow the same procedure in case of root nodes but I am not sure if there is a situation where you want duplicate (DEF and USE) root nodes.
So I seem to agree with Roy that setUSE is not necessary and perhaps incompatible. One complication it would introduce is that it becomes necessary to check if the reference DEF name actually exists and if the referenced node is of the same type as the provided node type. Another complication is that now setUSE is also responsible for checking namescopes.
In order to serialize out USEd nodes, one would first see if the node to serialize is a reference to an existing node. If it is, look up the DEF name and type and serialize as type USE=name.
I feel I am missing something,
Andreas
On Fri, Jul 21, 2017 at 11:44 AM, Don Brutzman <brutzman at nps.edu> wrote:
On 7/20/2017 3:02 PM, Andreas Plesch wrote:
SAI has importDocument
http://www.web3d.org/documents/specifications/19777-2/V3.3/Part2/functions.html#importDocument
where document is a DOM node org.w3c.dom.Node
added on the TODO list
http://www.web3d.org/specifications/java/X3DJSAIL.html#TODO
v/r Don
--
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170721/61e15e53/attachment.html>
More information about the x3d-public
mailing list