<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;
        color:windowtext;}
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.gmail-hoenzb
        {mso-style-name:gmail-hoenzb;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        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>var config = { attributes: true, childList: true, attributeFilter:['fromField'] };</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>May be a way to configure a MutationObserver to listen to a particular attribute change.  IDK.</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:Leonard.Daly@realism.com">Leonard Daly</a><br><b>Sent: </b>Friday, June 2, 2017 5:50 PM<br><b>To: </b><a href="mailto:andreasplesch@gmail.com">Andreas Plesch</a>; <a href="mailto:x3dom-users@lists.sourceforge.net">x3dom mlist</a>; <a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a><br><b>Subject: </b>Re: [x3d-public] [x3dom-users] port this example to X3DOM?</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Andreas,<br><br>Regarding the DOM...<br><br>DOM defines several events (and event handlers) for some items of interest here. <br><br>If the structure of a document changes (meaning a DOM element is added or removed), the a DOM mutation callback is invoked (note that mutation events have been deprecated). A callback is only involved if one was registered for this node (and children). You can directly insert or remove a DOM element: there is no event or callback that does this. The MutationObserver callback responds to the change.<br><br>Note that there is no MutationObserver action if a field/attribute/property value is changed. That kind of change does not change the structure of the DOM.<br><br>Since DOM events bubble (until captured or stopped), I would be careful about using those to handle large quantities of data (e.g., CoordinateInterpolator) or things that changed frequently (like every animation frame). <br><br>In DOM land, scripts can directly manipulate any DOM element including children and properties. Using a little of the X3D terminology, all DOM scripts come with "directOutput = TRUE". This has implications for the concept of an event cascade (doesn't happen in a single timestamp). DOM events get queued up for execution at the next pause in script execution.<br><br><br>Leonard Daly<br><br><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><div><p class=MsoNormal>On Fri, Jun 2, 2017 at 3:19 PM, Andreas Plesch <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.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-right:0in'><div><div><p class=MsoNormal>... Is there a conformance example ?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>There is one which uses directOut:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><a href="http://www.web3d.org/x3d/content/examples/ConformanceNist/Miscellaneous/Script/ScriptNodeFieldControl_EcmaScriptIndex.html">http://www.web3d.org/x3d/content/examples/ConformanceNist/Miscellaneous/Script/ScriptNodeFieldControl_EcmaScriptIndex.html</a><o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>But it does not test event generation and cascading as far as I can see. Also, cobweb does not seem to work with it indicating issues somewhere.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>-Andreas<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><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><o:p> </o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Jun 2, 2017 at 11:34 AM, Joe D Williams <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</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-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'>Yes, the script that uses directOut is like a DOM script.<br>Operationally, I think it is important to recognize that the directOut in x3d was designed to not produce an event directly. The x3d event is produced when the target node field is changed. In other worls, see that you cannot route an event from the directOut. The changed event must be generated by watching the target field of the node used by the directOut.<br><br>Joe<br><br><br><br>riginal Message ----- From: "Andreas Plesch" <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>><br>To: "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>><br>Cc: "x3dom mlist" <<a href="mailto:x3dom-users@lists.sourceforge.net" target="_blank">x3dom-users@lists.sourceforge.net</a>>; "X3D Graphics public mailing list" <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>Sent: Friday, June 02, 2017 8:11 AM<br>Subject: Re: [x3d-public] [x3dom-users] port this example to X3DOM?<br><br><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-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'>John,<br><br>I realized that the ported script uses what is equivalent to the<br>directOutput style of x3d scripts. This means that it may be possible to<br>convert directOutput scripts to x3dom scripts in general using the pattern<br>in the ported example.<br><br>The 'from' portion of Routes into the script would become 'outputchange'<br>listeners attached to the fromNodes with event handlers. The 'to' portion<br>of Routes into the script is used inside the event handler which then calls<br>the appropriate set script function.<br><br>The directOutput nodes can be retrieved by scene.querySelector(). The SAI<br>node.field syntax can be translated to node.get/setFieldValue or perhaps to<br>node._x3dom.field (or similar).<br><br>intialize() script functions can be run at document.onload time or probably<br>better using x3dom.runtime.ready<br><a href="https://doc.x3dom.org/author/runtime.html#ready" target="_blank">https://doc.x3dom.org/author/runtime.html#ready</a><br><br>There are probably lots of pitfalls, and does not address regular (non<br>directOutput) script nodes. -Andreas<br><br><br><br><br><br><br><br>On Wed, May 31, 2017 at 10:22 PM, Andreas Plesch <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>><br>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-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'>John,<br><br>I could make pretty quick progress to port this to x3d script over to dom<br>scripting style:<br><br><a href="https://warm-nape.glitch.me/" target="_blank">https://warm-nape.glitch.me/</a><br><br>You can 'remix' the code here:<br><br><a href="https://glitch.com/edit/#%21/warm-nape" target="_blank">https://glitch.com/edit/#!/warm-nape</a><br><br>[I like <a href="http://glitch.com" target="_blank">glitch.com</a>, and it has a built in server side]<br><br>The structure is pretty close to the original but probably will need to be<br>more generalized for easy reuse. It is a starting point anyways.<br><br>There is an initial reset of the green ball translation when it is dragged<br>first. Not sure where this is coming from but may only need minor fixing.<br><br>For routing, the main idea here is to use the x3dom onoutputchange event<br>as trigger. Other ideas are certainly possible or perhaps necessary for<br>generalization.<br><br>This uses get/setFieldValue rather than getAttribute because it is more<br>convenient and closer to SAI as it deals with field objects rather than<br>strings.<br><br>x3dom does not have methods for SFRotations since all rotations get<br>immediately translated to quaternions. But this is a detail at this point.<br><br>I think I like the idea of returning an object populated by output fields<br>from a main script function.<br><br>Take a look and feel free to mangle and reorganize,<br><br>Andreas<br><br><br>On Wed, May 31, 2017 at 4:26 PM, Andreas Plesch <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>><br>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-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'>Hi John,<br><br>I am going to take a look but do not wait for anything. I believe x3dom<br>has PlaneSensor.<br><br><a href="https://gist.github.com/andreasplesch/83771ec5959935d309db417387397952" target="_blank">https://gist.github.com/andreasplesch/83771ec5959935d309db417387397952</a><br>for easy access.<br><br>-Andreas<br><br>On Wed, May 31, 2017 at 3:44 PM, John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.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-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'>Can someone port the attached example to X3DOM?  It would help with the<br>X3DOM upgrade effort.<br><br><br><br>Thanks!<br><br><br><br>John<br><br><br><br>------------------------------------------------------------<br>------------------<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" target="_blank">http://sdm.link/slashdot</a><br>_______________________________________________<br>X3dom-users mailing list<br><a href="mailto:X3dom-users@lists.sourceforge.net" target="_blank">X3dom-users@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/x3dom-users</a><br><br><o:p></o:p></p></blockquote><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>--<br>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453<o:p></o:p></p></blockquote><p class=MsoNormal style='margin-bottom:12.0pt'><br><br><br>--<br>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453<o:p></o:p></p></blockquote><p class=MsoNormal style='margin-bottom:12.0pt'><br><br><br>-- <br>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453<o:p></o:p></p></blockquote><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>--------------------------------------------------------------------------------<br><br><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-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'>_______________________________________________<br>x3d-public mailing list<br><a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><o:p></o:p></p></blockquote><p class=MsoNormal><o:p> </o:p></p></blockquote></div><p class=MsoNormal><span style='color:#888888'><br><br clear=all></span><span class=gmail-hoenzb><span style='color:#888888'><o:p></o:p></span></span></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><span class=gmail-hoenzb><span style='color:#888888'>-- </span><o:p></o:p></span></p><div><p class=MsoNormal><span style='color:#888888'>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</span></p></div></div></div></div></blockquote></div><p class=MsoNormal><br><br clear=all><span style='color:black'><o:p></o:p></span></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><p class=MsoNormal>Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453<o:p></o:p></p></div></div></div><p class=MsoNormal><br><br><br><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">http://sdm.link/slashdot</a></pre><p class=MsoNormal><br><br><br><o:p></o:p></p><pre>_______________________________________________</pre><pre>X3dom-users mailing list</pre><pre><a href="mailto:X3dom-users@lists.sourceforge.net">X3dom-users@lists.sourceforge.net</a></pre><pre><a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users">https://lists.sourceforge.net/lists/listinfo/x3dom-users</a></pre></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></div></body></html>