<div dir="ltr">John,<div><br></div><div>I realized that the ported script uses what is equivalent to the directOutput style of x3d scripts. This means that it may be possible to convert directOutput scripts to x3dom scripts in general using the pattern in the ported example.</div><div><br></div><div>The 'from' portion of Routes into the script would become 'outputchange' listeners attached to the fromNodes with event handlers. The 'to' portion of Routes into the script is used inside the event handler which then calls the appropriate set script function.</div><div><br></div><div>The directOutput nodes can be retrieved by scene.querySelector(). The SAI node.field syntax can be translated to node.get/setFieldValue or perhaps to node._x3dom.field (or similar).</div><div><br></div><div>intialize() script functions can be run at document.onload time or probably better using x3dom.runtime.ready <a href="https://doc.x3dom.org/author/runtime.html#ready">https://doc.x3dom.org/author/runtime.html#ready</a></div><div><br></div><div>There are probably lots of pitfalls, and does not address regular (non directOutput) script nodes. -Andreas</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 31, 2017 at 10:22 PM, Andreas Plesch <span dir="ltr"><<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>John,</div><div><br></div><div>I could make pretty quick progress to port this to x3d script over to dom scripting style:</div><div><br></div><div><a href="https://warm-nape.glitch.me/" target="_blank">https://warm-nape.glitch.me/</a><br></div><div><br></div><div>You can 'remix' the code here:</div><div><br></div><a href="https://glitch.com/edit/#!/warm-nape" target="_blank">https://glitch.com/edit/#!/<wbr>warm-nape</a><br><div><br></div><div>[I like <a href="http://glitch.com" target="_blank">glitch.com</a>, and it has a built in server side]</div><div><br></div><div>The structure is pretty close to the original but probably will need to be more generalized for easy reuse. It is a starting point anyways.</div><div><br></div><div>There is an initial reset of the green ball translation when it is dragged first. Not sure where this is coming from but may only need minor fixing.</div><div><br></div><div>For routing, the main idea here is to use the x3dom onoutputchange event as trigger. Other ideas are certainly possible or perhaps necessary for generalization.</div><div><br></div><div>This uses get/setFieldValue rather than getAttribute because it is more convenient and closer to SAI as it deals with field objects rather than strings.</div><div><br></div><div>x3dom does not have methods for SFRotations since all rotations get immediately translated to quaternions. But this is a detail at this point.</div><div><br></div><div>I think I like the idea of returning an object populated by output fields from a main script function.</div><div><br></div><div>Take a look and feel free to mangle and reorganize,</div><div><br></div><div>Andreas</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 31, 2017 at 4:26 PM, Andreas Plesch <span dir="ltr"><<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi John,<div><br></div><div>I am going to take a look but do not wait for anything. I believe x3dom has PlaneSensor.</div><div><br></div><div><a href="https://gist.github.com/andreasplesch/83771ec5959935d309db417387397952" target="_blank">https://gist.github.com/andrea<wbr>splesch/83771ec5959935d309db41<wbr>7387397952</a> for easy access.</div><div><br></div><div>-Andreas</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 31, 2017 at 3:44 PM, John Carlson <span dir="ltr"><<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" 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_-318532695832605282m_-9220395532229420100m_-943787606009350455WordSection1"><p class="MsoNormal">Can someone port the attached example to X3DOM?  It would help with the X3DOM upgrade effort.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks!</p><span class="m_-318532695832605282m_-9220395532229420100HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">John</p><p class="MsoNormal"><u></u> <u></u></p></font></span></div></div><br>------------------------------<wbr>------------------------------<wbr>------------------<br>
Check out the vibrant tech community on one of the world's most<br>
engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" rel="noreferrer" target="_blank">http://sdm.link/slashdot</a><br>______________________________<wbr>_________________<br>
X3dom-users mailing list<br>
<a href="mailto:X3dom-users@lists.sourceforge.net" target="_blank">X3dom-users@lists.sourceforge.<wbr>net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/x3dom-users</a><br>
<br></blockquote></div><span class="m_-318532695832605282HOEnZb"><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-318532695832605282m_-9220395532229420100gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</font></span></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-318532695832605282gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div>