X3D Model Documentation: TimeTriggerTest.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
  3  <X3D profile='Immersive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'>
  4       <head>
  5            <meta name='titlecontent='TimeTriggerTest.x3d'/>
  6            <meta name='descriptioncontent='Test of TimeTrigger node.'/>
  7            <meta name='createdcontent='8 October 2007'/>
  8            <meta name='modifiedcontent='20 October 2019'/>
  9            <meta name='creatorcontent='Leonard Daly and Don Brutzman'/>
 10            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/TimeTriggerTest.x3d'/>
 11            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 12            <meta name='licensecontent='../license.html'/>
 13       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Filter, TextTouched, TraceScript, Trigger

Index for Viewpoint node: Viewpoint_1
-->
 14       <Scene>
 15            <WorldInfo title='TimeTriggerTest.x3d'/>
 16            <Background skyColor='1 1 1'/>
 17            <Viewpoint description='TimeTrigger testposition='0 0 7'/>
 18            <Transform>
 19                 <Shape>
 20                      <Appearance>
 21                           <Material diffuseColor='.6 0 .8'/>
 22                      </Appearance>
 23                      <Text string='"Touch text to print" "output values on console"'>
 24                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
 25                      </Text>
 26                 </Shape>
 27                 <!-- Selectable Text design pattern has transparent Box and TouchSensor description as a tooltip -->
 28                 <Shape>
 29                      <Box size='9 2 .001'/>
 30                      <Appearance>
 31                           <Material transparency='1'/>
 32                      </Appearance>
 33                 </Shape>
 34                 <!-- This TouchSensor only reacts to user clicking on the sibling Shape and Text, because it is under a parent Transform grouping node -->
 35 
               <!-- ROUTE information for TextTouched node:  [from isActive to Filter.set_boolean ] [from isActive to TraceScript.printBoolean ] -->
               <TouchSensor DEF='TextToucheddescription='touch to activate'/>
 36            </Transform>
 37 
          <!-- ROUTE information for Filter node:  [from TextTouched.isActive to set_boolean ] [from inputTrue to Trigger.set_boolean ] -->
          <BooleanFilter DEF='Filter'/>
 38            < ROUTE  fromNode='TextTouched' fromField='isActive' toNode='Filter' toField='set_boolean'/>
 39 
          <!-- ROUTE information for Trigger node:  [from Filter.inputTrue to set_boolean ] [from triggerTime to TraceScript.printTimestamp ] -->
          <TimeTrigger DEF='Trigger'/>
 40            < ROUTE  fromNode='Filter' fromField='inputTrue' toNode='Trigger' toField='set_boolean'/>
 41 
          <!-- ROUTE information for TraceScript node:  [from Trigger.triggerTime to printTimestamp ] [from TextTouched.isActive to printBoolean ] -->
          <Script DEF='TraceScript'>
 42                 <field name='printBooleantype='SFBoolaccessType='inputOnly'/>
 43                 <field name='printTimestamptype='SFTimeaccessType='inputOnly'/>
  <![CDATA[
      
ecmascript:
    function printBoolean (value) {
      Browser.println ('TouchSensor isActive="' + value + '"');
    }
    function printTimestamp (value) {
      Browser.println ('====================================' +  '');
      Browser.println ('Trigger triggerTime="' + value + '"');
    }

    
]]>
 45            </Script>
 46            < ROUTE  fromNode='Trigger' fromField='triggerTime' toNode='TraceScript' toField='printTimestamp'/>
 47            < ROUTE  fromNode='TextTouched' fromField='isActive' toNode='TraceScript' toField='printBoolean'/>
 48       </Scene>
 49  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: Filter, TextTouched, TraceScript, Trigger

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, Background, BooleanFilter, Box, field, FontStyle, head, Material, meta, ROUTE, Scene, Script, Shape, Text, TimeTrigger, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 4 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

TextTouched
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
Filter
BooleanFilter
set_boolean
SFBool
then
 
 
 
Filter
BooleanFilter
inputTrue
SFBool

ROUTE
event to
(2)
Trigger
TimeTrigger
set_boolean
SFBool
then
 
 
 
Trigger
TimeTrigger
triggerTime
SFTime

ROUTE
event to
(3)
TraceScript
Script
printTimestamp
SFTime
TextTouched
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
TraceScript
Script
printBoolean
SFBool

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/TimeTriggerTestIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/TimeTriggerTest.x3d -->

<!-- Color legend: X3D terminology <X3dNode DEF='idName' field='value'/> matches XML terminology <XmlElement DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
-->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->