[x3d-public] setUSE in X3DJSAIL. Impact on X3DJSONLD.

Leonard Daly Leonard.Daly at realism.com
Fri Jul 21 14:14:31 PDT 2017


On 7/21/2017 1:33 PM, John Carlson wrote:
>
> 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?
>

John,

Are you asking can there be a (new) attribute (say 'DU') that does a 
'DEF' on the first occurrence of a value and a 'USE' on subsequent 
occurrences?

That means the parser would need to examine the value before determining 
what to do. It would also be necessary to define what happens if this is 
running in a browser and JavaScript code changes the value of the DU 
attribute. If this is first in the scene graph does every other node 
with matching DU value become a copy/reference of it? What happens if 
the scene is serialized?

At least with a separate DEF & USE certain operations become errors or 
at least are ignored.


Leonard Daly



> Is it for human understanding?
>
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for 
> Windows 10
>
> *From: *Andreas Plesch <mailto:andreasplesch at gmail.com>
> *Sent: *Friday, July 21, 2017 4:08 PM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>
> *Cc: *John Carlson <mailto:yottzumm at gmail.com>; X3D Graphics public 
> mailing list <mailto:x3d-public at web3d.org>
> *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 
> <mailto: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
>
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org


-- 
*Leonard Daly*
3D Systems & Cloud Consultant
LA ACM SIGGRAPH Chair
President, Daly Realism - /Creating the Future/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170721/f19c21f2/attachment.html>


More information about the x3d-public mailing list