<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://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
='
https://www.web3d.org/specifications/x3d-3.0.xsd
'
>
<head>
</head>
<!--
<!--
Event Graph ROUTE Table
shows event connections
-->
<!--
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
Index for ProtoDeclare definition:
KeySensor
-->
<Scene>
<!-- The KeySensor prototype can be omitted if native-node Keysensor support is provided by the VRML browser. -->
<WorldInfo title='KeySensorActivationKeySwitchTest.x3d'/>
<ProtoDeclare name='KeySensor'>
<ProtoInterface>
<!-- warning: enabled needs to become an exposedField once Scripts support exposedField -->
<field name='enabled' type='SFBool' value='true' accessType='initializeOnly'/>
<field name='set_enabled' type='SFBool' accessType='inputOnly'/>
<field name='enabled_changed' type='SFBool' accessType='outputOnly'/>
<field name='isActive' type='SFBool' accessType='outputOnly'/>
<field name='keyPress' type='SFInt32' accessType='outputOnly'/>
<field name='keyRelease' type='SFInt32' accessType='outputOnly'/>
<field name='actionKeyPress' type='SFInt32' accessType='outputOnly'/>
<field name='actionKeyRelease' type='SFInt32' accessType='outputOnly'/>
<field name='altKey' type='SFBool' accessType='outputOnly'/>
<field name='controlKey' type='SFBool' accessType='outputOnly'/>
<field name='shiftKey' type='SFBool' accessType='outputOnly'/>
</ProtoInterface>
<ProtoBody>
<!-- First node in prototype indicates node type, use Group so that this sensor is ChildNodeType. -->
<Group>
<Script DEF='KeySensorScript'>
<field name='altKey' type='SFBool' accessType='outputOnly'/>
<field name='keyPress' type='SFInt32' accessType='outputOnly'/>
<field name='set_enabled' type='SFBool' accessType='inputOnly'/>
<field name='keyRelease' type='SFInt32' accessType='outputOnly'/>
<field name='enabled' type='SFBool' accessType='initializeOnly'/>
<field name='shiftKey' type='SFBool' accessType='outputOnly'/>
<field name='actionKeyRelease' type='SFInt32' accessType='outputOnly'/>
<field name='isActive' type='SFBool' accessType='outputOnly'/>
<field name='actionKeyPress' type='SFInt32' accessType='outputOnly'/>
<field name='enabled_changed' type='SFBool' accessType='outputOnly'/>
<field name='controlKey' type='SFBool' accessType='outputOnly'/>
<IS>
<connect nodeField='enabled' protoField='enabled'/>
<connect nodeField='set_enabled' protoField='set_enabled'/>
<connect nodeField='enabled_changed' protoField='enabled_changed'/>
<connect nodeField='isActive' protoField='isActive'/>
<connect nodeField='keyPress' protoField='keyPress'/>
<connect nodeField='keyRelease' protoField='keyRelease'/>
<connect nodeField='actionKeyPress' protoField='actionKeyPress'/>
<connect nodeField='actionKeyRelease' protoField='actionKeyRelease'/>
<connect nodeField='altKey' protoField='altKey'/>
<connect nodeField='controlKey' protoField='controlKey'/>
<connect nodeField='shiftKey' protoField='shiftKey'/>
</IS>
<![CDATA[
ecmascript:
// Native support for KeySensor node
// or keyboard-access code needed!
]]>
</ProtoDeclare>
<!-- ============================================ -->
<!-- Enabling this KeySensor (from TouchSensor.isActive) disables all other KeySensors. -->
<Billboard>
<Transform translation='0 2 0'>
<Shape>
<Text string='"Touch this text to enable" "KeySensor activation keys then" "press activation keys to test"'>
</Text>
<Appearance>
<Material diffuseColor='0.9 0.9 0.4'/>
</Appearance>
</Shape>
<
ROUTE
fromNode='
StartMessageTouched' fromField='isOver' toNode='
SingleKeySensor' toField='enabled'/>
</Transform>
<Transform translation='0 -1 0'>
<!-- ROUTE is not treated as a selectable child of Switch -->
<
ROUTE
fromNode='
SingleKeySensor' fromField='actionKeyPress' toNode='
ActivationKeyMessageSwitch' toField='whichChoice'/>
<Shape DEF='Zero'>
<Text string='"No activation keypress sensed...."'>
</Text>
<Appearance DEF='SelectionAppearance'>
<Material diffuseColor='0 1 0'/>
</Appearance>
</Shape>
<Shape DEF='One'>
</Shape>
<Shape DEF='Two'>
</Shape>
<Shape DEF='Three'>
</Shape>
<Shape DEF='Four'>
</Shape>
<Shape DEF='Five'>
</Shape>
<Shape DEF='Six'>
</Shape>
<Shape DEF='Seven'>
</Shape>
<Shape DEF='Eight'>
</Shape>
<Shape DEF='Nine'>
</Shape>
<Shape DEF='Ten'>
</Shape>
<Shape DEF='Eleven'>
</Shape>
<Shape DEF='Twelve'>
</Shape>
<Shape DEF='Thirteen'>
</Shape>
<Shape DEF='Fourteen'>
</Shape>
<Shape DEF='Fifteen'>
</Shape>
<Shape DEF='Sixteen'>
</Shape>
<Shape DEF='Seventeen'>
</Shape>
<Shape DEF='Eighteen'>
</Shape>
<Shape DEF='Nineteen'>
</Shape>
<Shape DEF='Twenty'>
</Shape>
</Switch>
</Transform>
</Billboard>
</Scene>
</X3D>
<!--
<!--
Event Graph ROUTE Table
shows event connections
-->
<!--
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
Index for ProtoDeclare definition:
KeySensor
-->
-->
<!--
Online at
https://www.web3d.org/x3d/content/examples/Basic/development/KeySensorActivationKeySwitchTestIndex.html
-->
<!--
Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/KeySensorActivationKeySwitchTest.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)
<ProtoDeclare
name='ProtoName'>
<field
name='fieldName'/> </ProtoDeclare>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->