[x3d-public] This script worked before adding addRoute/deleteRoute.
John Carlson
yottzumm at gmail.com
Mon Dec 9 09:24:10 PST 2024
Can someone confirm if this script looks like valid SAI?
The scene was working great until I added addRoute/deleteRoute.
Thanks!
John
<Script DEF="Script21">
<field name="inTime" type="SFTime" accessType="inputOnly"/>
<field name="fraction" type="SFFloat" accessType="inputOutput"
value="0"/>
<field name="diffuseColor" type="SFColor" accessType="inputOutput"
value="0 0 1"/>
<field name="checked" type="SFBool" accessType="inputOutput"
value="false"/>
<![CDATA[ecmascript:
function inTime(value) {
// Browser.print("in", diffuseColor.g, diffuseColor.b);
if (value) {
checked = !checked;
}
scene = Browser.currentScene;
if (checked) {
scene.addRoute(scene.getNamedNode("Main_Clock"),
'fraction_changed', scene.getNamedNode("AnimationAdapter_JinMouthStretch"),
'set_fraction');
diffuseColor.g = 1;
diffuseColor.b = 0;
fraction = 0;
} else {
scene.deleteRoute(scene.getNamedNode("Main_Clock"),
'fraction_changed', scene.getNamedNode("AnimationAdapter_JinMouthStretch"),
'set_fraction');
diffuseColor.g = 1;
diffuseColor.g = 0;
diffuseColor.b = 1;
fraction = 0;
}
// Browser.print("out", diffuseColor.g, diffuseColor.b);
}
]]>
</Script>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20241209/7dcbe291/attachment.html>
More information about the x3d-public
mailing list