[x3d-public] FW: X3D meeting minutes 1 MAR 2019: X3Dv4architectureand event-exchange diagrams, progress review

John Carlson yottzumm at gmail.com
Sat Mar 2 16:08:53 PST 2019


Sorry, I was zonked all day yesterday, and just got up today. Here were my research findings when I was trying to add Scripts to X3DOM.

1) There is no Script or fields for Script implemented in X3DOM AFAIK.  X3DOM uses HTML scripting.   Thus you can’t ROUTE to Script fields.  Script fields are not processed into X3DOM routes or X3DOM anything AFAIK.
2) It might be possible to implement fields for Script.  It shouldn’t matter what you call Script in X3DOM.  X3DScript should be fine.   I will use that from now in my discussions. That is, scripts or Scripts, embedded in X3D (scripts with fields) are X3DScripts.  You will have to figure out how to otherwise change the JavaScript X3DScript code to read and modify JavaScript variables in concordance with fields.   This is work I have done which is available in X3DJSONLD. I used eval, not new Function(). I wrote my own ROUTEing code since I removed the fields and CDATA nodes from my X3DScript, and there is a shared variable between my evals. I would like to hide this variable from the global context, but haven’t discovered the perfect way yet. If you implement the X3DScript fields in X3DOM, you should be able to leverage X3DOM’s routing/events, but I didn’t really test this sufficiently.  X3DOM’s ComposedShader fields work with ROUTEs, so I see no reason why X3DScripts couldn’t.  AFAIK, X3DScript fields currently have no implementation in X3DOM.
3) If someone wants to modify my code to fully add X3DScripts to X3DOM, they are welcome work with my X3DJSONLD—I have made it work for many if not all of my X3DScripts, but I have several from X3D Resources Examples that do not work. It’s probably best to start fresh with a X3DOM implementation of script field ROUTEs.
4) The X3DScript (non-generated) code I wrote is in a single module and does not extend outside that yet.  However, the main interface accepts JSON to find X3DScript in.   We would have to change that to DOM.
5) I do not have an XML implementation of X3DScripts (only JSON), so I avoid most of the HTML script tag discussion.
6) You may make scripts unrunnable by specifying an illegal type attribute, possibly making the CDATA/text node runnable through new Function or eval. (thanks Andreas)

So the main effort involved is implementing fields and connection between JavaScript and fields and ROUTEs and fields.  I do not know if you have to replace the script tag with something else or not, but I doubt it…so what if the JavaScript runs first?   Put all your X3D code in functions! Make it a requirement that all X3DScript code be functions, if it isn’t already!

Hopefully you will get something you like.

If someone has JavaScript code they would like to use in an X3DScript that uses classes, imports, etc. Please give it to me for testing.   Thanks!

John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190302/29ee60ad/attachment.html>


More information about the x3d-public mailing list