<div dir="auto"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On May 20, 2017 11:47 PM, "Andreas Plesch" <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_-6294331270920413317quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div class="m_-6294331270920413317quoted-text"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On May 20, 2017 8:46 PM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_-6294331270920413317m_-7720787538940258316quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div class="m_-6294331270920413317m_-7720787538940258316m_4955718199248972002WordSection1"><p class="MsoNormal">I would like to separate the main scene loading from the sub scene loading, so I can load many, many subscenes, plus it will make coding easier.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am almost able to do that, but I am not sure when the Scene object loads in the main scene.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">What wasn’t working before was that the child scene was added before it displayed in Cobweb.  That has been fixed now.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">It’s an Inline, but not in typical X3D parlance.  It’s a DOM object added afterwards, by using a selector on the DOM.</p><p class="MsoNormal"><u></u> </p></div></div></blockquote></div></div></div></div><div dir="auto">I see. In terms of the X3D event model it would be then be safer to have a global Group and add the late content as children to this Group. For cobweb and cobweb_dom, however, this should not be necessary since cobweb treats Scene as a grouping node already.</div><div class="m_-6294331270920413317quoted-text"><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-6294331270920413317m_-7720787538940258316quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div class="m_-6294331270920413317m_-7720787538940258316m_4955718199248972002WordSection1"><p class="MsoNormal"><u></u></p><p class="MsoNormal">I can expand prototypes inline, as the example now shows.  That’s not a problem, really.  I just want to make a way NOT to expand PROTOs for Cobweb.</p></div></div></blockquote></div></div></div></div><div dir="auto">A user option in the JSON loader/expander to not expand ?</div><div class="m_-6294331270920413317quoted-text"><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-6294331270920413317m_-7720787538940258316quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div class="m_-6294331270920413317m_-7720787538940258316m_4955718199248972002WordSection1"><p class="MsoNormal">Yes, I am loading X3DJSON into Cobweb AND X3DOM, using the same DOM tree (probably not a good idea).</p><p class="MsoNormal"><u></u></p></div></div></blockquote></div></div></div></div><div dir="auto">Probably not because X3DOM has quite a few non but almost standard nodes (such as CommonSurfaceShader) which JSON should also support. </div><div class="m_-6294331270920413317quoted-text"><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-6294331270920413317m_-7720787538940258316quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div class="m_-6294331270920413317m_-7720787538940258316m_4955718199248972002WordSection1"><p class="MsoNormal"><u></u></p><p class="MsoNormal">Yes, I am interested in your DOM event which is dispatched when a Scene is fully loaded.  Could you go and check?  Thanks!</p><div class="m_-6294331270920413317m_-7720787538940258316quoted-text"><p class="MsoNormal"><u></u></p></div></div></div></blockquote></div></div></div><div dir="auto"><br></div></div><div dir="auto">Will do.</div><div class="m_-6294331270920413317elided-text"><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-6294331270920413317m_-7720787538940258316quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div class="m_-6294331270920413317m_-7720787538940258316m_4955718199248972002WordSection1"><div class="m_-6294331270920413317m_-7720787538940258316quoted-text"></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><a href="https://github.com/andreasplesch/cobweb_dom/blob/master/cobweb/cobweb_dom.js#L359" target="_blank">https://github.com/<wbr>andreasplesch/cobweb_dom/blob/<wbr>master/cobweb/cobweb_dom.js#<wbr>L359</a><br></div><div dir="auto"><br></div><div dir="auto">After an Inline is fully loaded and appended, a 'x3dload' event is dispatched and can be listened to on the X3D element.</div><div dir="auto"><br></div><div dir="auto">Cobweb (but not x3dom) fully supports the LoadSensor node, and cobweb_dom relays the x3d load event as x3d_load dom node event as well.</div><div dir="auto"><br></div><div dir="auto">The SAI may have something when the browser is done loading a scene, perhaps a browser service.</div><div dir="auto"><br></div><div dir="auto">Andreas</div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="m_-6294331270920413317quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div class="m_-6294331270920413317elided-text"><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-6294331270920413317m_-7720787538940258316quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="#954F72"><div class="m_-6294331270920413317m_-7720787538940258316m_4955718199248972002WordSection1"><div class="m_-6294331270920413317m_-7720787538940258316quoted-text"><br><p class="MsoNormal">John</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal"><u></u> <u></u></p><div style="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:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Sent: </b>Saturday, May 20, 2017 8:21 PM<br><b>To: </b><a href="mailto:yottzumm@gmail.com" target="_blank">John Carlson</a><br><b>Cc: </b><a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a>; <a href="mailto:x3d-public@web3d.org" target="_blank">X3D Graphics public mailing list</a>; <a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom-users@lists.sourceforge.<wbr>net</a><br><b>Subject: </b>Re: Cobweb_dom...Script Magic? Loading DOM subscenes after parent inX3DOM and Cobweb.</p></div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Hi John,</p><div class="m_-6294331270920413317m_-7720787538940258316elided-text"><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">it is difficult for me to see what is not working, in the example. It looks like it is working but only by using callbacks in custom methods and you would rather use Promises in reusable fashion ?</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">By child DOM scenegraph, do you mean a scene which is added as an Inline to another (parent) scene ? Hm. it looks more like an appended Transform group which would be quite different.</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I think for cobweb_dom I added a dom event which is dispatched when an Inline or Scene is fully loaded but I would have to go back and check. Events would be another way to guarantee a sequence of loading.</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">jquery xhr and regular xhr have mechanisms to allow acting on when a request is fulfilled (which is I think what you are using).</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">It may be necessary to come up with a minimal, non-working example which shows the issue. Is dealing with expanding prototypes related to sequencing ?</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I think you are also trying to show how to load json encoded x3d with x3dom and cobweb ?</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Sorry to be of no more constructive help, eg. asking all the returned questions,</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Andreas</p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Sat, May 20, 2017 at 5:23 PM, John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:</p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal">Cobweb_dom, X3DOM experts, I need some help adding a child DOM scenegraph with prototypes to a parent DOM scenegraph after the 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.</p><p class="MsoNormal"> </p><p class="MsoNormal">Here is my example so far:</p><p class="MsoNormal"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html" target="_blank">https://github.com/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/html/flipper.html</a><br><br>Viewable here:</p><p class="MsoNormal"><a href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html" target="_blank">https://coderextreme.net/X3DJS<wbr>ONLD/src/main/html/flipper.htm<wbr>l</a></p><p class="MsoNormal"> </p><p class="MsoNormal">The white Box is the subscene of the dolphin scene.</p><p class="MsoNormal"> </p><p class="MsoNormal">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/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/node/loaderJQuery.js</a></p><p class="MsoNormal">and references code from:</p><p class="MsoNormal"> </p><p class="MsoNormal"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js" target="_blank">https://github.com/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/node/X3DJSONLD.js</a></p><p class="MsoNormal">[ actually, I think the last two reference each other – naughty ]</p><p class="MsoNormal"> </p><p class="MsoNormal">Data is here:</p><p class="MsoNormal">[ child scenegraph ]</p><p class="MsoNormal"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json" target="_blank">https://github.com/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/data/abox.json</a></p><p class="MsoNormal"> </p><p class="MsoNormal">[ parent scenegraph ]</p><p class="MsoNormal"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json" target="_blank">https://github.com/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/data/flipp.json</a></p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">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:</p><p class="MsoNormal"> </p><p class="MsoNormal"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js" target="_blank">https://github.com/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/node/PrototypeExpander.js</a></p><p class="MsoNormal"><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js" target="_blank">https://github.com/coderextrem<wbr>e/X3DJSONLD/blob/master/src/ma<wbr>in/node/Flattener.js</a></p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">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.</p><p class="MsoNormal"> </p><p class="MsoNormal">And if you start supporting X3D JSON in your viewers, that would be even better!</p><p class="MsoNormal"> </p><p class="MsoNormal">John</p><p class="MsoNormal"> </p><p class="MsoNormal">/**</p><ul type="disc"><li class="MsoNormal" style="margin-left:0in">Next is passed the element parameter</li><li class="MsoNormal" style="margin-left:0in">*/</li></ul><p class="MsoNormal">function appendInline(element, url, next) {</p><p class="MsoNormal">        $.getJSON(url, function(json) {</p><p class="MsoNormal">                if (typeof prototypeExpander === 'function') {</p><p class="MsoNormal">                        json = prototypeExpander(url, json, "");</p><p class="MsoNormal">                } else {</p><p class="MsoNormal">                        console.error("Perhaps you need to include the PrototypeExpander.js?");</p><p class="MsoNormal">                }</p><p class="MsoNormal">                if (typeof flattener === 'function') {</p><p class="MsoNormal">                        json = flattener(json);</p><p class="MsoNormal">                } else {</p><p class="MsoNormal">                        console.error("Perhaps you need to include the Flattener.js?");</p><p class="MsoNormal">                }</p><p class="MsoNormal">                // must validate here because we call an inner method.</p><p class="MsoNormal">                loadSchema(json, url, doValidate, function() {</p><p class="MsoNormal">                        ConvertToX3DOM(json["X3D"]["Sc<wbr>ene"], "Scene", element, url);</p><p class="MsoNormal">                        next(element);</p><p class="MsoNormal">                }, function(e) {</p><p class="MsoNormal">                        console.error(e);</p><p class="MsoNormal">                });</p><p class="MsoNormal">        }).fail(function(jqXHR, textStatus, errorThrown) { alert('getJSON request failed! ' + textStatus + ' ' + errorThrown); });</p><p class="MsoNormal">}</p><p class="MsoNormal"> </p><p class="MsoNormal">/**</p><ul type="disc"><li class="MsoNormal" style="margin-left:0in">Next is passed the selected element from selector</li><li class="MsoNormal" style="margin-left:0in">Selector is the CSS selector to append inline to.</li><li class="MsoNormal" style="margin-left:0in">*/</li></ul><p class="MsoNormal">function loadSubscene(selector, url, next) {</p><p class="MsoNormal">        appendInline(document.querySel<wbr>ector(selector), url, next);</p><p class="MsoNormal">}</p></div></div></blockquote></div><p class="MsoNormal"><br><br clear="all"></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- </p></div></div></div><div class="m_-6294331270920413317m_-7720787538940258316elided-text"><p class="MsoNormal">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</p><p class="MsoNormal"><u></u> <u></u></p></div></div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>