<div dir="ltr">On Sat, Oct 29, 2016 at 2:25 PM, Don Brutzman <span dir="ltr"><<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10/29/2016 8:19 AM, Andreas Plesch wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I updated<br>
<br>
<a href="https://rawgit.com/andreasplesch/cobweb_dom/proto/tests/interactiveTransformations.xhtml" rel="noreferrer" target="_blank">https://rawgit.com/andreasples<wbr>ch/cobweb_dom/proto/tests/inte<wbr>ractiveTransformations.xhtml</a><br>
<br>
to show a fade-in/out effect for the rotor handles when hovering over the teapot, and decided to use event utilities rather than scripting.<br>
</blockquote>
<br>
looks great, works well!  8)<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
It was quick to see that TimeTrigger could be used to trigger the fade animation as TouchSensor does not generate a time event for just hovering. It was harder for me to recognize that BooleanFilter would allow for invoking the different interpolators for fading in and fading out.<br>
</blockquote>
<br>
For anyone looking to learn more: in addition to tooltips, there are also examples, slideset, video and quick-reference sheet on Event Utilities.<br>
</blockquote><div><br></div><div>These are great. Since the declarative approach to animation control can be quite unfamiliar, the examples are very important.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Here is the relevant animation section:<br>
<br>
<!-- fade gizmo in and out --><br>
<TimeSensor DEF='timerIn' cycleInterval='1' enabled='true' /><br>
<TimeSensor DEF='timerOut' cycleInterval='1' enabled='true' /><br>
<TimeTrigger DEF='getTimeIn' /><br>
<TimeTrigger DEF='getTimeOut' /><br>
<BooleanFilter DEF='splitBool' /><br>
<ROUTE fromNode='bandsSensor' fromField='isOver' toNode='splitBool' toField='set_boolean' /><br>
<ROUTE fromNode='splitBool' fromField='inputTrue' toNode='getTimeIn' toField='set_boolean' /><br>
<ROUTE fromNode='splitBool' fromField='inputFalse' toNode='getTimeOut' toField='set_boolean' /><br>
<ROUTE fromNode='getTimeIn' fromField='triggerTime' toNode='timerIn' toField='startTime' /><br>
<ROUTE fromNode='getTimeOut' fromField='triggerTime' toNode='timerOut' toField='startTime' /><br>
<ScalarInterpolator DEF='fadeIn' key='0 0.5 1' keyValue='0.9 0.25 0' /><br>
<ScalarInterpolator DEF='fadeOut' key='0 0.5 1' keyValue='0 0.75 0.9' /><br>
<ROUTE fromNode='timerIn' fromField='fraction_changed' toNode='fadeIn' toField='set_fraction' /><br>
<ROUTE fromNode='timerOut' fromField='fraction_changed' toNode='fadeOut' toField='set_fraction' /><br>
<ROUTE fromNode='fadeIn' fromField='value_changed' toNode='RED_APP_Mat' toField='transparency' /><br>
<ROUTE fromNode='fadeOut' fromField='value_changed' toNode='RED_APP_Mat' toField='transparency' /><br>
<br>
<br>
It looks rather verbose and I am wondering if there is a more concise way to achieve the same effect without scripting ? The answer may well be to use a script.<br>
</blockquote></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Yes it can be verbose.<br></blockquote><div><br></div><div>Ok. I was concerned that I missed something. For example, I first thought it should be possible to use a single clock, and then somehow switch its output to different interpolators. Or even use a single interpolator, and have somehow an additional (1 - value_changed) computation for fading in. But that means a script. Or have a single interpolator and feed it different keyValues.<br></div><div>So perhaps a FloatArrayTrigger node ? Should the event utilities cover more than Integer and Time data types ?<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I have found that arranging nodes in reverse order of flow, top-to-bottom showing destination-to-resource, allows ROUTEs to appear immediately after the node where they are actionable.  If actually printing out a pretty print version of the scene, it lets you draw the ROUTE lines without nearly so much criss-crossing of the lines.  This is a helpful technique for animation-chain design and manual debugging.<br></blockquote><div><br></div><div>Yes, I noticed that arrangement in the examples archive. With descriptive DEF names, it is also nice to have all the ROUTEs in one place to quickly follow where events flow.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I also learned that it can be useful to 'debug' the flow of x3d events. One way is to have a script log things to the console.<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 Are there builtin tools in x3d editors to help with tracing events (perhaps as they happen) ?<br>
</blockquote>
<br>
X3D-Edit offers such a feature for X3D authors as part of many node editing panels.<br>
<br>
        <a href="https://savage.nps.edu/X3D-Edit/#New" rel="noreferrer" target="_blank">https://savage.nps.edu/X3D-Edi<wbr>t/#New</a><br>
<br>
        "_Trace outputs_ are available for ROUTE, sensors, interpolators and other nodes that produce or consume events. Results are logged on the browser console to show the timing and values passed events. When Trace is selected by the author, a Script node is inserted to accomplish this task. This is a useful debugging technique."<br>
        <a href="https://savage.nps.edu/X3D-Edit/images/TraceFeatureReportsRoutedEventValuesOnBrowserConsoleViaScriptOutput.png" rel="noreferrer" target="_blank">https://savage.nps.edu/X3D-Edi<wbr>t/images/TraceFeatureReportsRo<wbr>utedEventValuesOnBrowserConsol<wbr>eViaScriptOutput.png</a><br>
<br>
This check-box feature is offered for event-producing nodes and also the ROUTE editor.  (TODO: need to add this feature to Script and ProtoInstance editing panes, iterating over fields.)<br></blockquote><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Something especially helpful for authors is that the trace statements are inserted in your debug scene.  This content-based approach lets you test any X3D player independently.  You can turn trace statements on/off by moving comments around (or simply deleting them).  Simple but effective
</blockquote><div><div><br></div>Excellent, good idea. I should give it a try, especially since I started to do that manually.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I believe that some X3D development environments have offered integrated trace/debugging features, but am unfamiliar with any in common use.  Certainly powerful when they work!<br>
<br>
Attached is your example with a few trace-script blocks inserted by X3D-Edit.  (Note that the derivative DEF names inside the added tracing scripts permit uniqueness.)  Once I copied/pasted/created the new scene with your fragment, adding the traces (i.e. selecting 4 'Trace' checkboxes) took about a minute.  Pretty-print html versions also generated (by button push) and attached for convenience.<br></blockquote><div><br></div><div>Since logging all fields for all nodes becomes quickly a bit overwhelming, it would be a nice touch to be able select in the GUI which fields are traced (by default all).  <br></div><br></div><div class="gmail_quote">-Andreas<br></div></div></div>