[x3d-public] This script worked before adding addRoute/deleteRoute.
John Carlson
yottzumm at gmail.com
Mon Dec 9 09:33:40 PST 2024
Apparently there was some kind of caching issue with Sunrize, when I used
npx sunrize at latest, everything was perfect.
deleteRoute does not work in FreeWRL, and has been reported to Doug.
Thanks,
John
On Mon, Dec 9, 2024 at 11:24 AM John Carlson <yottzumm at gmail.com> wrote:
> 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/ecc67918/attachment.html>
More information about the x3d-public
mailing list