<div dir="ltr">I want to change the cycleTime of a TimeSensor in a x3d script:<br><div><div><div><div><br><a href="https://raw.githubusercontent.com/andreasplesch/cobweb_dom/master/tests/dynamicCycleTime.x3d">https://raw.githubusercontent.com/andreasplesch/cobweb_dom/master/tests/dynamicCycleTime.x3d</a><br><br></div><div>cycleTime input events are ignored when the TimeSensor is enabled. So it is necessary to disable it first, then change the cycleTime and then reenable it.<br><br></div><div>However, in all tested browser the above does not work as expected. These are cobweb, instant player and bs contact. bs contact also has this console message:<br>Script node speeder: parse error: line 16 "time.cycleInterval = 2;" ()<br></div><div>and therefore does not get to change the color to grey. <br></div><div>The javascript sai does not have a SFTime constructor and allows numbers. <br></div><div><br>cobweb and instant player change the color but do not slow down the ball.<br></div><div>I first thought that cobweb does not correctly work through the sequence of events but since no browser works sofar I start to think that I am missing something.<br><br></div><div>Any help or feedback appreciated,<br><br></div><div>-Andreas<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 19, 2016 at 8:39 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Roy,<br><br></div>Here is a cobweb version of the updated example:<br><div><br><a href="https://rawgit.com/andreasplesch/cobweb_dom/master/tests/html5/cobweb_integration2.html" target="_blank">https://rawgit.com/<wbr>andreasplesch/cobweb_dom/<wbr>master/tests/html5/cobweb_<wbr>integration2.html</a><br><br>I removed all features which are only supported by or necessary for the x3dom version.<br><p>The main necessary changes were:</p><p>- use
setAttribute on DOM elements rather than DOM element properties because
cobweb does not create these properties. x3dom allows for using
setAttribute() in addition to setting properties.<br></p><p>- use a TouchSensor node to enable
clicking on the ball instead of the onclick attribute. Cobweb ignores
the onclick attribute and x3dom ignores the touch sensor. In Cobweb the TouchSensor generates and is the target of a dom event ('x3d_touchTime') which can be received by an installed listener. The .addEventListener() call does this.<br></p><p>- modify the scale attribute of the enclosing transform instead
of the radius attribute of the sphere since radius is not recognized as an input field in Cobweb as it interprets the spec. this way.<br></p>I also looked more closely into why I had to introduce a timeout delay to make the TimeSensor cycleInterval change have an effect. It turns that there were multiple reasons. Interestingly, the first reason had to do with how the DOM spec. defines Mutation Observers and I filed a spec. issue: <br><a href="https://github.com/whatwg/dom/issues/376" target="_blank">https://github.com/whatwg/dom/<wbr>issues/376</a><br></div><div>In effect, the enabled='false' mutation was not reported fully. I could fix this in cobweb_dom, so it was a worthy investigation.<br></div><div>Also interestingly, the second reason had to with how cobweb processes input events. From what I understand first fields get tainted and are then processed in the cascade. I think the second set_enabled event occurred before the first had a chance to be processed and reset the target value back. This was also possible to fix in cobweb_dom by forcing processing after each mutation (input event).<br><br></div><div>As a result, the delay is not necessary anymore and the sequence works as expected.<br><br></div><div>-Andreas<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 12, 2016 at 5:48 AM, Roy Walmsley <span dir="ltr"><<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-GB"><div class="gmail-m_-6388147814545009549gmail-m_-7534906277962009388WordSection1"><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Hi Andreas,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Having a Cobweb version is great. Thank you very much.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">You’re comments are also interesting. Lots of food for thought. I will modify both examples to illustrate using X3D output events as well, as I have completely missed that feature. I’ll also modify the titles to include the implementation, and put both on the web site.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Regards,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Roy<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11pt;font-family:"calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11pt;font-family:"calibri",sans-serif" lang="EN-US"> Andreas Plesch [mailto:<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.co<wbr>m</a>] <br><b>Sent:</b> 12 November 2016 01:19<br><b>To:</b> Roy Walmsley <<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.com</a>><br><b>Cc:</b> X3D Graphics Working Group <<a href="mailto:x3d@web3d.org" target="_blank">x3d@web3d.org</a>><br><b>Subject:</b> Re: X3D / DOM integration example using X3DOM<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p>Hi Roy,<u></u><u></u></p><p>this is a nice example, demonstrating main integration features.<u></u><u></u></p><p>I modified it to work with cobweb_dom:<u></u><u></u></p><p><a href="https://rawgit.com/andreasplesch/cobweb_dom/master/tests/html5/cobweb_integration.html" target="_blank">https://rawgit.com/andreasples<wbr>ch/cobweb_dom/master/tests/<wbr>html5/cobweb_integration.html</a><u></u><u></u></p><p>This should also still work mostly unchanged with x3dom although it looks perhaps quite different.<u></u><u></u></p><p>The main necessary changes were:<u></u><u></u></p><p>- use setAttribute on DOM elements rather than DOM element properties because cobweb does not create these properties. x3dom allows for using setAttribute.<u></u><u></u></p><p>- use a TouchSensor node to enable clicking on the ball instead of the onclick attribute. Cobweb ignores the onclick attribute and x3dom ignores the touch sensor.<u></u><u></u></p><p>- introduce a small delay after disabling the time sensor to make sure it is actually disabled when the cycle interval is set in an input event. This looks like it should not be necessary to do, so will require some investigation.<u></u><u></u></p><p>- modify the scale attribute instead of the radius attribute since radius is not an input field. Cobweb follows the spec. strictly, x3dom is more liberal. Radius should become an input field.<u></u><u></u></p><p>So two questions emerge:<u></u><u></u></p><p>Should DOM element properties be required? No, in my opinion, since attributes are the more fundamental component and definitely required in the XML encoding. It is probably possible to have another layer which translates attributes into properties and back.<u></u><u></u></p><p>Which x3d output events should be exposed and how ? Following x3d conventions (TouchSensor) or following DOM event conventions (click) ? Undecided, leaning towards x3d, perhaps both. x3dom and Cobweb expose all output events, x3dom with outputchange and Cobweb with x3d_eventname.<br>(It would be probably possible to implement click and other dom event dispatchers by adding sensor nodes to the scene graph but not to the dom tree).<u></u><u></u></p><p>Andreas <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Fri, Nov 11, 2016 at 10:13 AM, Roy Walmsley <<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal">Hi all,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Following Wednesday’s open meeting I have put together an example that illustrates the integration of an X3D scene into an HTML web page, that also incorporates SVG. It includes events, both X3D and HTML. There is also interaction between X3D, SVG, and HTML in multiple directions.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">The intention was to provide a simple (but not high quality!) example to facilitate thinking about specification requirements.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Sorry that I couldn’t put the example directly onto one of our web pages. But it should be easy for you to copy and paste to create your own file and open it up in a browser. The only browser that’s failed me so far is Safari.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Here’s the link: <a href="http://www.web3d.org/member/wiki/x3d-svg-html-dom-integration-example-using-x3dom" target="_blank">http://www.web3d.org/member/wi<wbr>ki/x3d-svg-html-dom-integratio<wbr>n-example-using-x3dom</a><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Have fun,<u></u><u></u></p><p class="MsoNormal"><span style="color:rgb(136,136,136)"> <u></u><u></u></span></p><p class="MsoNormal"><span style="color:rgb(136,136,136)">Roy<u></u><u></u></span></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">PS As it came up on Wednesday I have also added an HTML slider, demonstrating instant updating.<u></u><u></u></p></div></div></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <span class="gmail-HOEnZb"><font color="#888888"><u></u></font></span></p></div><span class="gmail-HOEnZb"><font color="#888888"><p class="MsoNormal">-- <u></u><u></u></p><div><p class="MsoNormal">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453<u></u><u></u></p></div></font></span></div></div></div></blockquote></div><span class="gmail-HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div class="gmail-m_-6388147814545009549gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div></div></div></div></div>