<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        color:black;}
p.m7357056672881959298msonormal, li.m7357056672881959298msonormal, div.m7357056672881959298msonormal
        {mso-style-name:m_7357056672881959298msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here are my two initial attempts at getting Script routes working in the JavaScript environment.  One uses CSS and function calls after preprocessing script fields.  The generated JavaScript is evaled into the browser environment.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js</a></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The main routine in this javaScript script is processScripts()</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I put the CSS and function calls into a loop for my event handling.  The output is handled by loaderJQuery.js with this function:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This uses X3D JSON:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>function loadScripts(json) {</p><p class=MsoNormal>    if ($('#scripting').is(':checked')) {</p><p class=MsoNormal>        // Now generate JavaScript code for Scripts and Routes</p><p class=MsoNormal>        var classes = new LOG();</p><p class=MsoNormal>        var routecode = new LOG();</p><p class=MsoNormal>        routecode.log("var __eventTime = 0;");</p><p class=MsoNormal>        routecode.log("function runRoutes() {");</p><p class=MsoNormal>        processScripts(json, classes, undefined, routecode);</p><p class=MsoNormal>        routecode.log("__eventTime += 1000 / 60;");</p><p class=MsoNormal>        routecode.log("}");</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        if (typeof intervalId !== 'undefined') {</p><p class=MsoNormal>                console.log("Interval", intervalId, "cleared");</p><p class=MsoNormal>                clearInterval(intervalId);</p><p class=MsoNormal>        }</p><p class=MsoNormal>        if (typeof X3DJSON !== 'undefined') {</p><p class=MsoNormal>                delete X3DJSON;</p><p class=MsoNormal>        }</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        $("#scripts").remove();</p><p class=MsoNormal>        var scripts = document.createElement('script');</p><p class=MsoNormal>        scripts.id = "scripts";</p><p class=MsoNormal>        scripts.type = 'text/javascript';</p><p class=MsoNormal>        scripts.text = classes.join("\n");</p><p class=MsoNormal>        $('body').append(scripts);</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        $("#routes").remove();</p><p class=MsoNormal>        var routes =  document.createElement('script');</p><p class=MsoNormal>        routes.id = "routes";</p><p class=MsoNormal>        routes.type = 'text/javascript';</p><p class=MsoNormal>        routes.text = routecode.join("\n");</p><p class=MsoNormal>        $('body').append(routes);</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        // When we zap the source, we prevent animation</p><p class=MsoNormal>        // zapSource(json);</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>        // console.log(scripts.text);</p><p class=MsoNormal>        try {</p><p class=MsoNormal>                // console.log(scripts.text);</p><p class=MsoNormal>                // TODO eval is evil</p><p class=MsoNormal>                eval(scripts.text);</p><p class=MsoNormal>        } catch (e) {</p><p class=MsoNormal>                console.error(e);</p><p class=MsoNormal>        }</p><p class=MsoNormal>        // console.log(routes.text);</p><p class=MsoNormal>        try {</p><p class=MsoNormal>                // console.log(routes.text);</p><p class=MsoNormal>                // TODO eval is evil</p><p class=MsoNormal>                eval(routes.text);</p><p class=MsoNormal>        } catch (e) {</p><p class=MsoNormal>                console.error(e);</p><p class=MsoNormal>        }</p><p class=MsoNormal>        intervalId = setInterval(runRoutes, 1000 / 60 );</p><p class=MsoNormal>    }</p><p class=MsoNormal>}</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The second just implements Proxies as “routes”, and so far, does not call functions.  setInternalField() would have to be modified to call a function with a value (merely test to see whether the field is a value or a function, and call the function with the value and a timestamp), and then getter functions and events (calling setField()) would have to be implemented.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/route.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/route.js</a></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:yottzumm@gmail.com">John Carlson</a><br><b>Sent: </b>Monday, May 22, 2017 10:41 AM<br><b>To: </b><a href="mailto:Leonard.Daly@realism.com">Leonard Daly</a><br><b>Cc: </b><a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a>; <a href="mailto:x3dom-users@lists.sourceforge.net">x3dom-users@lists.sourceforge.net</a>; <a href="mailto:andreasplesch@gmail.com">Andreas Plesch</a>; <a href="mailto:holger.seelig@yahoo.de">holger.seelig@yahoo.de</a><br><b>Subject: </b>RE: [x3dom-users] Cobweb_dom...Script Magic? Loading DOMsubscenesafter parent in X3DOM and Cobweb. ALMOST complete, requiressequencing ofouter functions.</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Why make scripts optional?  Yes, perhaps other languages besides JavaScript should be optional, but at least JavaScript X3D scripts should be included if we have to use eval and other tricks.  If they don’t initially support SAI, and deal with DOM directly, is that a bad thing?  If you want to make DOM part of or replace SAI, that’s OK by me, but make X3D Script ROUTEing at least work in X3DOM, please.  I don’t really need Proto’s implemented because of my Proto Expander.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Scripts have been implemented by Cobweb.  Why not by someone else? I really would like to route to and from an X3D Script please.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So for me, ROUTEing with Scripts are vitally important to getting my expanded protos (that is, no protos) working.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If you have a way to convert X3D Script ROUTEs to HTML and JavaScript please let us know.  That’s what I want implemented.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b>From: </b><a href="mailto:Leonard.Daly@realism.com">Leonard Daly</a><br><b>Sent: </b>Monday, May 22, 2017 10:06 AM<br><b>To: </b><a href="mailto:yottzumm@gmail.com">John Carlson</a><br><b>Cc: </b><a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a>; <a href="mailto:x3dom-users@lists.sourceforge.net">x3dom-users@lists.sourceforge.net</a>; <a href="mailto:andreasplesch@gmail.com">Andreas Plesch</a>; <a href="mailto:holger.seelig@yahoo.de">holger.seelig@yahoo.de</a><br><b>Subject: </b>Re: [x3dom-users] Cobweb_dom...Script Magic? Loading DOM subscenesafter parent in X3DOM and Cobweb. ALMOST complete, requires sequencing ofouter functions.<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>John,<br><br>I have not been convinced that Protos need to exist in an HTML environment. Scripts are an integral piece of the Proto architecture so if you path is to implement Protos on the way to implementing Scripts, you need to solve the entire Script problem first. If Scripts are optional, then why have Proto? I think something like a macro expansion can solve all of the use cases where Proto would be used while being lighter weight and easier to implement and possibly use.<br><br>Leonard Daly<o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>Leonard, I believe Scripts should be implemented AFTER Protos.   Just my opinion.  Once the Protos and the ROUTEs and the Scripts are expanded with the new DEFs, then you apply the event model.   This makes things easier, but takes more memory.   Then you optimize.   Beware premature optimization. <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>John<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On May 21, 2017 12:16 AM, "Leonard Daly" <<a href="mailto:Leonard.Daly@realism.com">Leonard.Daly@realism.com</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:40.8pt'>John,<br><br>I don't really like to answer this way, but why?<br><br>X3DOM does not have Proto/ExternProto feature. It does not have X3D Script node. The integration with HTML is too close to allow an X3D Script node. HTML JavaScript (via DOM and X3D node manipulation) is available and used extensively. X3DOM does not handle VRML (meaning a text file with {} syntax). There is an unofficial JSON loader. Perhaps you have one too. How does it get the scene graph into DOM? Does it create DOM elements (or perhaps an HTML text string which is then parsed)? Something else?<br><br>To the extent I understand your question, you are asking for help in constructing a means of handling X3D Script node in X3DOM. Once that is done, Proto/ExternProto would be next. This would all come into the browser through an JSON encoded file. It seems to me that trying to handle X3D Script code requires an entire infrastructure supporting the X3D event mode and calling script code with X3D arguments. It also requires building full support for SAI and supporting the 'directOutput' field. That is a major effort with no obvious purpose that I see in V4.<br><br>You are asking for some serious time support (I think) into an application that is neither fully X3D-compliant, nor DOM-compliant (but the closest to both that is available). At least for me, I do not understand how this effort would further an X3D integrated DOM system. I am quite willing to listen to your reasons and help where I can, but I would like to see where this is going first.<br><br>Leonard Daly<br><br>P.S.  Everything above is for client-side code. Server side code can manipulate things as much as it wants to create something that runs in a client-side browser.<br><br>P.P.S. I do think there is a need to JSON encoding in V4 subject to the node definition for V4.<br><br><o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal style='margin-left:76.8pt'>Yes, Leonard, for quite some time I have an X3D JSON PROTOtypeExpander.js that works with X3D PROTOs and EXTERNPROTOs and displays in X3DOM.  I don’t know how complete it is, and testers are welcome. My EXTERNPROTO expander runs on the server, so is not included in the message, but it is included in the link in the original message.  If someone can make the EXTERNPROTO expander work client side that would be great.<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>The EXTERNPROTO expander is generally called like:<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>                json = externPrototypeExpander(outfile, json);<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>Where json is the parent json of the extern, and outfile is the parent X3D file being loaded (I think “” will probably do in a pinch.  I am not sure.).  The extern PROTOs will be included in the original JSON as a ProtoDeclare object.  You may have to run the flattener afterwards, and it is run as:<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'><span style='font-size:14.0pt'>            json = flattener(json);</span><o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'><span style='font-size:14.0pt'> </span><o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>It removes empty objects from the JSON.<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>Yes, I would like someone to help me with VRMLScript for X3DOM, if someone is available.  I have a very barebones and incorrect implementation here:<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>Please help.  I don’t know the X3D event model, and I’m not likely to learn soon.  The X3D event model can be emulated in Browser-side JavaScript, but there’s only Cobweb for proof.<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'><br>I have another version of flipper.html here that works with X3DOM and Cobweb adding the subscene later.  It works with Promises, but the functions still aren’t separated…close, but no cigar.  Take a look:<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html</a><o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>Sorry, I tend to use the XML version of “Proto”, and not the VRML “PROTO”.<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>X3DJSONLD provides an infrastructure for X3D JSON Browser development, including X3D XML -> X3D JSON conversion on the server, and X3D JSON to X3D XML loading into X3DOM and Cobweb.  It also includes conversions from XML DOM to Java and Nashorn JavaScript for X3DJSAIL app development.<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>There is definite potential for an XML PROTO expander, as I have written this code, but not seriously tested:<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>So far, it’s still server-side.  If you’re going to modify it, split it into server and client-side pieces, please.  Complete is probably a misnomer…<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>Thanks,<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>John<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10<o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='margin-left:76.8pt'><b>From: </b><a href="mailto:Leonard.Daly@realism.com" target="_blank">Leonard Daly</a><br><b>Sent: </b>Saturday, May 20, 2017 7:17 PM<br><b>To: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a>; <a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a>; <a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a><br><b>Cc: </b><a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom-users@lists.sourceforge.net</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a><br><b>Subject: </b>Re: [x3dom-users] Cobweb_dom...Script Magic? Loading DOM subscenesafter parent in X3DOM and Cobweb.<o:p></o:p></p></div><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:76.8pt'>John,<o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal style='margin-left:112.8pt'>Cobweb_dom, X3DOM experts, I need some help adding a child DOM scenegraph with prototypes to a parent DOM scenegraph after the <o:p></o:p></p></blockquote><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:76.8pt'><br>Not sure how any of this applies to X3DOM as it does not have PROTOs. Assuming you mean X3D prototypes via PROTO or EXTERNPROTO. If you mean something else, please elaborate.<br><br><br>Leonard Daly<br><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal style='margin-left:112.8pt'>primary scene has been  loaded, and not before. I have an example of loading before the scene is loaded, and in a callback.  If you have an example with Promises instead of callback nesting, that would be more ideal, the second $.getJSON() (child scenegraph) might finish before the first $.getJSON() (parent scenegraph) if I don’t use promises or callback nesting. Also, Promises would allow me to separate the parent loading somewhat from the child loading, and create separate functions.  Also, X3DOM experts can provide an example with Promises as well.  Meanwhile, I will be reading about Promises.<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>Here is my example so far:<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html</a><br><br>Viewable here:<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html" target="_blank">https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>The white Box is the subscene of the dolphin scene.<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>The following related code is from <a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>and references code from:<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>[ actually, I think the last two reference each other – naughty ]<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>Data is here:<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>[ child scenegraph ]<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>[ parent scenegraph ]<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>Cobweb doesn’t need the prototypeExpander or the flattener (well, it might have with prototypes in cobweb_dom, but I think the last release fixed that…haven’t checked—here is a good test for you!).  This is a dual example, and I haven’t figured out how to conditionally run the prototypeExpander on only X3DOM code.  Please test without the PrototypeExpander.js and Flattener.js included, and remove X3DOM, since it won’t work in that case.  X3DOM folks can include the two JavaScript files which are here:<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js" target="_blank">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js</a><o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>You may provide your own appendInline (below) which doesn’t call loadSchema.  That may be too complex of a download.  That is, you probably don’t want to do all that JSON schema validation in your example.  Try to keep my code close to what it is otherwise.<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>And if you start supporting X3D JSON in your viewers, that would be even better!<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>John<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>/**<o:p></o:p></p><p class=m7357056672881959298msonormal style='margin-left:56.25pt;line-height:105%'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;line-height:105%;font-family:"Times New Roman",serif'>         </span>Next is passed the element parameter</p><p class=m7357056672881959298msonormal style='margin-left:56.25pt;line-height:105%'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;line-height:105%;font-family:"Times New Roman",serif'>         </span>*/</p><p class=MsoNormal style='margin-left:112.8pt'>function appendInline(element, url, next) {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>        $.getJSON(url, function(json) {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                if (typeof prototypeExpander === 'function') {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        json = prototypeExpander(url, json, "");<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                } else {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        console.error("Perhaps you need to include the PrototypeExpander.js?");<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                }<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                if (typeof flattener === 'function') {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        json = flattener(json);<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                } else {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        console.error("Perhaps you need to include the Flattener.js?");<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                }<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                // must validate here because we call an inner method.<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                loadSchema(json, url, doValidate, function() {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        ConvertToX3DOM(json["X3D"]["Scene"], "Scene", element, url);<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        next(element);<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                }, function(e) {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                        console.error(e);<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>                });<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>        }).fail(function(jqXHR, textStatus, errorThrown) { alert('getJSON request failed! ' + textStatus + ' ' + errorThrown); });<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>}<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'> <o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>/**<o:p></o:p></p><p class=m7357056672881959298msonormal style='margin-left:1.0in;line-height:105%'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;line-height:105%;font-family:"Times New Roman",serif'>         </span>Next is passed the selected element from selector</p><p class=m7357056672881959298msonormal style='margin-left:1.0in;line-height:105%'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;line-height:105%;font-family:"Times New Roman",serif'>         </span>Selector is the CSS selector to append inline to.</p><p class=m7357056672881959298msonormal style='margin-left:1.0in;line-height:105%'><span style='font-family:Symbol'>·</span><span style='font-size:7.0pt;line-height:105%;font-family:"Times New Roman",serif'>         </span>*/</p><p class=MsoNormal style='margin-left:112.8pt'>function loadSubscene(selector, url, next) {<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>        appendInline(document.querySelector(selector), url, next);<o:p></o:p></p><p class=MsoNormal style='margin-left:112.8pt'>}<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:112.8pt'><o:p> </o:p></p><pre>------------------------------------------------------------------------------</pre><pre>Check out the vibrant tech community on one of the world's most</pre><pre>engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" target="_blank">http://sdm.link/slashdot</a></pre><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:112.8pt'><o:p> </o:p></p><pre>_______________________________________________</pre><pre>X3dom-users mailing list</pre><pre><a href="mailto:X3dom-users@lists.sourceforge.net" target="_blank">X3dom-users@lists.sourceforge.net</a></pre><pre><a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/x3dom-users</a></pre></blockquote><p> </p><p class=MsoNormal style='margin-left:76.8pt'>-- <br><b><span style='font-size:13.5pt;color:#333366'>Leonard Daly</span></b><span style='color:#333366'><br>3D Systems & Cloud Consultant<br>LA ACM SIGGRAPH Chair<br>President, Daly Realism - <i>Creating the Future</i> </span><o:p></o:p></p><p class=MsoNormal style='margin-left:76.8pt'> <o:p></o:p></p></div></blockquote><p><o:p> </o:p></p><div><p class=MsoNormal style='margin-left:40.8pt'>-- <br><b><span style='font-size:13.5pt;color:#333366'>Leonard Daly</span></b><span style='color:#333366'><br>3D Systems & Cloud Consultant<br>LA ACM SIGGRAPH Chair<br>President, Daly Realism - <i>Creating the Future</i> </span><o:p></o:p></p></div></div></blockquote></div></div></blockquote><p><o:p> </o:p></p><p class=MsoNormal>-- <br><b><span style='font-size:13.5pt;color:#333366'>Leonard Daly</span></b><span style='color:#333366'><br>3D Systems & Cloud Consultant<br>LA ACM SIGGRAPH Chair<br>President, Daly Realism - <i>Creating the Future</i> </span><o:p></o:p></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>