<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' http://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='titlecontent='KeySensorActivationKeySwitchTest.x3d'/>
<meta name='descriptioncontent='A simple scene to show KeySensor functionality using Text nodes.'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='createdcontent='22 June 2001'/>
<meta name='modifiedcontent='12 January 2014'/>
<meta name=' warning content=" This doesn't work because there is no KeySensor implementation yet! Prototype script (written in Java) or native node support for KeySensor is needed. "/>
<meta name=' warning content=' enabled accessType needs to be changed to exposedField once supported by Script capabilities '/>
<meta name='referencecontent=' http://www.web3d.org/x3d/specification-2000july/part1/nodesDef.html#KeySensor '/>
<meta name='referencecontent=' http://www.web3d.org/x3d/sai/javadoc/org/web3d/x3d/sai/Core/KeySensor.html '/>
<meta name='identifiercontent=' http://www.web3d.org/x3d/content/examples/Basic/development/KeySensorActivationKeySwitchTest.x3d '/>
<meta name='referencecontent=' http://www.web3d.org/x3d/content/examples/Basic/ConformanceNist/Sensors/Keyboard/KeySensorActivationKeySwitchTest.x3d '/>
<meta name='subjectcontent='KeySensor'/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<!-- The KeySensor prototype can be omitted if native-node Keysensor support is provided by the VRML browser. -->
<ProtoDeclare name='KeySensor'>
<ProtoInterface>
<!-- warning: enabled needs to become an exposedField once Scripts support exposedField -->
<field name='enabledtype='SFBoolvalue='trueaccessType='initializeOnly'/>
<field name='set_enabledtype='SFBoolaccessType='inputOnly'/>
<field name='enabled_changedtype='SFBoolaccessType='outputOnly'/>
<field name='isActivetype='SFBoolaccessType='outputOnly'/>
<field name='keyPresstype='SFInt32accessType='outputOnly'/>
<field name='keyReleasetype='SFInt32accessType='outputOnly'/>
<field name='actionKeyPresstype='SFInt32accessType='outputOnly'/>
<field name='actionKeyReleasetype='SFInt32accessType='outputOnly'/>
<field name='altKeytype='SFBoolaccessType='outputOnly'/>
<field name='controlKeytype='SFBoolaccessType='outputOnly'/>
<field name='shiftKeytype='SFBoolaccessType='outputOnly'/>
</ProtoInterface>
<ProtoBody>
<!-- First node in prototype indicates node type, use Group so that this sensor is ChildNodeType. -->
<Group>
<Script DEF='KeySensorScript'>
<field name='altKeytype='SFBoolaccessType='outputOnly'/>
<field name='keyPresstype='SFInt32accessType='outputOnly'/>
<field name='set_enabledtype='SFBoolaccessType='inputOnly'/>
<field name='keyReleasetype='SFInt32accessType='outputOnly'/>
<field name='enabledtype='SFBoolaccessType='initializeOnly'/>
<field name='shiftKeytype='SFBoolaccessType='outputOnly'/>
<field name='actionKeyReleasetype='SFInt32accessType='outputOnly'/>
<field name='isActivetype='SFBoolaccessType='outputOnly'/>
<field name='actionKeyPresstype='SFInt32accessType='outputOnly'/>
<field name='enabled_changedtype='SFBoolaccessType='outputOnly'/>
<field name='controlKeytype='SFBoolaccessType='outputOnly'/>
<IS>
<connect nodeField='enabledprotoField='enabled'/>
<connect nodeField='set_enabledprotoField='set_enabled'/>
<connect nodeField='enabled_changedprotoField='enabled_changed'/>
<connect nodeField='isActiveprotoField='isActive'/>
<connect nodeField='keyPressprotoField='keyPress'/>
<connect nodeField='keyReleaseprotoField='keyRelease'/>
<connect nodeField='actionKeyPressprotoField='actionKeyPress'/>
<connect nodeField='actionKeyReleaseprotoField='actionKeyRelease'/>
<connect nodeField='altKeyprotoField='altKey'/>
<connect nodeField='controlKeyprotoField='controlKey'/>
<connect nodeField='shiftKeyprotoField='shiftKey'/>
</IS>
<![CDATA[
            
ecmascript:

// Native support for KeySensor node
// or keyboard-access code needed!

          
]]>
</Script>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ============================================ -->
<!-- Enabling this KeySensor (from TouchSensor.isActive) disables all other KeySensors. -->
<!-- ROUTE information for SingleKeySensor node:  [from StartMessageTouched.isOver to enabled ] [from actionKeyPress to ActivationKeyMessageSwitch.whichChoice ] -->
<KeySensor DEF='SingleKeySensorenabled='false'/>
<Billboard>
<Transform translation='0 2 0'>
<Shape>
<Text string='"Touch this text to enable" "KeySensor activation keys then" "press activation keys to test"'>
<FontStyle DEF='MiddleMiddlejustify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material diffuseColor='0.9 0.9 0.4'/>
</Appearance>
</Shape>
<!-- ROUTE information for StartMessageTouched node:  [from isOver to SingleKeySensor.enabled ] -->
<TouchSensor DEF='StartMessageToucheddescription='Touch this text to enable KeySensor activation keys then press activation keys to test'/>
<ROUTE fromNode='StartMessageTouchedfromField='isOvertoNode='SingleKeySensortoField='enabled'/>
</Transform>
<Transform translation='0 -1 0'>
<!-- ROUTE information for ActivationKeyMessageSwitch node:  [from SingleKeySensor.actionKeyPress to whichChoice ] -->
<Switch DEF='ActivationKeyMessageSwitchwhichChoice='0'>
<!-- ROUTE is not treated as a selectable child of Switch -->
<ROUTE fromNode='SingleKeySensorfromField='actionKeyPresstoNode='ActivationKeyMessageSwitchtoField='whichChoice'/>
<Shape DEF='Zero'>
<Text string='"No activation keypress sensed...."'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance DEF='SelectionAppearance'>
<Material diffuseColor='0 1 0'/>
</Appearance>
</Shape>
<Shape DEF='One'>
<Text string='"F1"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Two'>
<Text string='"F2"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Three'>
<Text string='"F3"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Four'>
<Text string='"F4"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Five'>
<Text string='"F5"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Six'>
<Text string='"F6"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Seven'>
<Text string='"F7"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Eight'>
<Text string='"F8"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Nine'>
<Text string='"F9"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Ten'>
<Text string='"F10"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Eleven'>
<Text string='"F11"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Twelve'>
<Text string='"F12"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Thirteen'>
<Text string='"13: HOME"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Fourteen'>
<Text string='"14: END"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Fifteen'>
<Text string='"15: LEFT"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Sixteen'>
<Text string='"16: RIGHT"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Seventeen'>
<Text string='"17: UP"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Eighteen'>
<Text string='"18: DOWN"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Nineteen'>
<Text string='"19: PGUP"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
<Shape DEF='Twenty'>
<Text string='"20: PGDN"'>
<FontStyle USE='MiddleMiddle'/>
</Text>
<Appearance USE='SelectionAppearance'/>
</Shape>
</Switch>
</Transform>
</Billboard>
</Scene>
</X3D>
<!--

Index for ProtoDeclare definition : KeySensor

Index for DEF nodes : ActivationKeyMessageSwitch, Eight, Eighteen, Eleven, Fifteen, Five, Four, Fourteen, KeySensorScript, MiddleMiddle, Nine, Nineteen, One, SelectionAppearance, Seven, Seventeen, SingleKeySensor, Six, Sixteen, StartMessageTouched, Ten, Thirteen, Three, Twelve, Twenty, Two, Zero
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D extensibility)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->