TimeTriggerExt

This proto was posted by peter on 2007-07-05.

So far there are 0 comments. Feel free to add one.

Quick links

Description

An extended TimeTrigger which can be parameterized when to fire an event. It mimics the interface of the standard TimeTrigger and can be used as a drop-in replacement.

When an event is sent to the set_boolean input, the triggerTime and triggerNegate outputs fire an event depending on the parameter fields.

Interface

Field name Value type Field type Default value
negateOnFalse SFBool initializeOnly true
If “true”, the “triggerNegate” outputs the negated input whenever the “set_boolean” input is sent a “false” value. If “false”, the “triggerNegate” does not output the negated input when the “set_boolean” input is sent a “false” value.
negateOnTrue SFBool initializeOnly true
If “true”, the “triggerNegate” outputs the negated input whenever the “set_boolean” input is sent a “true” value. If “false”, the “triggerNegate” does not output the negated input when the “set_boolean” input is sent a “true” value.
timeOnFalse SFBool initializeOnly true
Determines whether a “timeTrigger” event is fired when the “set_boolean” input is sent a “false” value.
timeOnTrue SFBool initializeOnly true
Determines whether a “timeTrigger” event is fired when the “set_boolean” input is sent a “true” value.
set_boolean SFBool inputOnly
Sending an event to this fields triggers the output fields depending on the given parameters.
triggerNegate SFBool outputOnly
Sends the negated input, depending on the given parameters.
triggerTime SFTime outputOnly
Sends the time of the input on the set_boolean field, depending on the given parameters.

Proto code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<ProtoDeclare name='TimeTriggerExt' component='peschler' documentation='An extended TimeTrigger which can be parameterized when to fire an event.'>
  
<ProtoInterface>
    <field name='set_boolean' type='SFBool' accessType='inputOnly' 
          documentation='Sending an event to this fields triggers the output fields  depending on the given parameters.'/>        
    <field name='triggerTime' type='SFTime' accessType='outputOnly' 
          documentation='Sends the time of the input on the set_boolean field, depending on the given parameters.'/>            
    <field name='triggerNegate' type='SFBool' accessType='outputOnly' 
          documentation='Sends the negated input, depending on the given parameters.'/> 
    
    <field name='timeOnTrue' type='SFBool' accessType='initializeOnly' value='true' 
          documentation='Determines whether a "timeTrigger" event is fired when the "set_boolean" input is sent a "true" value.'/>
    <field name='timeOnFalse' type='SFBool' accessType='initializeOnly' value='true'
          documentation='Determines whether a "timeTrigger" event is fired when the "set_boolean" input is sent a "false" value.'/> 
    <field name='negateOnTrue' type='SFBool' accessType='initializeOnly' value='true'
          documentation='If "true", the "triggerNegate" outputs the negated input whenever the "set_boolean" input is sent a "true" value. If "false", the "triggerNegate" does not output the negated input when the "set_boolean" input is sent a "true" value.'/>
    <field name='negateOnFalse' type='SFBool' accessType='initializeOnly' value='true'
          documentation='If "true", the "triggerNegate" outputs the negated input whenever the "set_boolean" input is sent a "false" value. If "false", the "triggerNegate" does not output the negated input when the "set_boolean" input is sent a "false" value.'/>         
</ProtoInterface>
    
<ProtoBody>     
    <Script directOutput='true' mustEvaluate='true'>                      
        <field name='set_boolean' type='SFBool' accessType='inputOnly' />        
        <field name='triggerTime' type='SFTime' accessType='outputOnly' />            
        <field name='triggerNegate' type='SFBool' accessType='outputOnly' /> 
        
        <field name='timeOnTrue' type='SFBool' accessType='initializeOnly' value='true' />
        <field name='timeOnFalse' type='SFBool' accessType='initializeOnly' value='true'/> 
        <field name='negateOnTrue' type='SFBool' accessType='initializeOnly' value='true' />
        <field name='negateOnFalse' type='SFBool' accessType='initializeOnly' value='true'/>               
        <IS>                  
            <connect protoField='set_boolean' nodeField='set_boolean'/>
            <connect protoField='triggerTime' nodeField='triggerTime'/>
            <connect protoField='triggerNegate' nodeField='triggerNegate'/>
            <connect protoField='timeOnTrue' nodeField='timeOnTrue'/>
            <connect protoField='timeOnFalse' nodeField='timeOnFalse'/>
            <connect protoField='negateOnTrue' nodeField='negateOnTrue'/>
            <connect protoField='negateOnFalse' nodeField='negateOnFalse'/>
        </IS>
        <![CDATA[ javascript:
            function set_boolean(v, t) {                
                if(v==true && timeOnTrue) triggerTime = t;
                if(v==true && negateOnTrue) triggerNegate = !v;
                  
                if(v==false && timeOnFalse) triggerTime = t;
                if(v==false && negateOnFalse) triggerNegate = !v;                      
            }
        ]]>
    </Script>
</ProtoBody>   

</ProtoDeclare>    

Test code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?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 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' profile='Full' version='3.0' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.0.xsd'>
<Scene DEF='scene'>

<ExternProtoDeclare name='TimeTriggerExt' url='TimeTriggerExt.x3d' />
  
<TimeTriggerExt DEF='timeTriggerExt' />

<TimeTriggerExt DEF='timeTriggerExt2' negateOnFalse='false' timeOnFalse='false' />

<TimeTriggerExt DEF='timeTriggerExt3'  timeOnTrue='false' />

</Scene>
</X3D>
  
  

Comments

There are no comments yet.

Add a comment