[x3d-public] Having a bit of difficult ROUTEing to node outside the ProtoDeclare in Sunrize
John Carlson
yottzumm at gmail.com
Sat Feb 1 01:23:06 PST 2025
Here's another attempt: It works mostly, but Adapter fraction doesn't
reset anymore. Still doesn't get rid of scripts.
<ProtoDeclare name="MenuItem">
<ProtoInterface>
<field name="translation" accessType="inputOutput" type="SFVec3f" />
<field name="textTranslation" accessType="inputOutput"
type="SFVec3f" />
<field name="description" accessType="inputOutput" type="SFString"
/>
<field name="menuItemString" accessType="inputOutput"
type="MFString" />
<field name="startTime" accessType="inputOutput" type="SFTime" />
<field name="stopTime" accessType="inputOutput" type="SFTime" />
<field name="enabled" accessType="inputOutput" type="SFBool" />
<field name="size" accessType="initializeOnly" type="SFVec2f"
value="40.0 3.0" />
<field name="fontSize" accessType="inputOutput" type="SFFloat"
value="2.4" />
<field name="spacing" accessType="initializeOnly" type="SFFloat"
value="1.2" />
</ProtoInterface>
<ProtoBody>
<Group>
<TimeSensor DEF="standin_clock" cycleInterval="0.99" loop="true"
enabled="true">
<IS>
<connect nodeField="startTime" protoField="startTime" />
<connect nodeField="stopTime" protoField="stopTime" />
<connect nodeField="enabled" protoField="enabled" />
</IS>
</TimeSensor>
<Transform>
<IS>
<connect nodeField="translation" protoField="translation" />
</IS>
<TouchSensor DEF="StartStopAnimationUnit_Sensor">
<IS>
<connect nodeField="description" protoField="description" />
</IS>
</TouchSensor>
<Transform translation="0 0 0">
<IS>
<connect nodeField="translation" protoField="textTranslation"
/>
</IS>
<Shape>
<Appearance>
<Material diffuseColor="1 1 1" />
</Appearance>
<Text>
<IS>
<connect nodeField="string" protoField="menuItemString"
/>
</IS>
<FontStyle justify=""MIDDLE" "MIDDLE"">
<IS>
<connect nodeField="size" protoField="fontSize" />
<connect nodeField="spacing" protoField="spacing" />
</IS>
</FontStyle>
</Text>
</Shape>
</Transform>
<Transform translation="0 0 -0.01">
<Shape>
<Appearance>
<Material DEF="MenuBackground_Material" diffuseColor="0 0
1" />
</Appearance>
<Rectangle2D size="40.0 3.0">
<IS>
<connect nodeField="size" protoField="size" />
</IS>
</Rectangle2D>
</Shape>
</Transform>
</Transform>
<Script DEF="ScriptToggle">
<field name="inTime" type="SFTime" accessType="inputOnly" />
<field name="diffuseColor" type="SFColor" accessType="inputOutput"
value="0 0 1" />
<field name="checked" type="SFBool" accessType="inputOutput"
value="false" />
<field name="startTime" accessType="inputOutput" type="SFTime" />
<field name="stopTime" accessType="inputOutput" type="SFTime"
/><![CDATA[
ecmascript:
function inTime(value, tm) {
if (value) {
checked = !checked;
}
Browser.print("in", checked, diffuseColor.g, diffuseColor.b);
if (checked) {
startTime = tm;
diffuseColor.g = 1;
diffuseColor.b = 0;
} else {
stopTime = tm;
diffuseColor.g = 0;
diffuseColor.b = 1;
}
}
]]></Script>
* <ROUTE fromNode="StartStopAnimationUnit_Sensor" fromField="touchTime"
toNode="ScriptToggle" toField="inTime" /> <ROUTE
fromNode="ScriptToggle" fromField="startTime" toNode="standin_clock"
toField="startTime" /> <ROUTE fromNode="ScriptToggle"
fromField="stopTime" toNode="standin_clock" toField="stopTime" />
<ROUTE fromNode="ScriptToggle" fromField="checked" toNode="standin_clock"
toField="enabled" />*
<ROUTE fromNode="MenuBackground_Material" fromField="diffuseColor"
toNode="ScriptToggle" toField="diffuseColor" />
<ROUTE fromNode="ScriptToggle" fromField="diffuseColor"
toNode="MenuBackground_Material" toField="diffuseColor" />
</Group>
</ProtoBody>
</ProtoDeclare>
<ProtoInstance DEF="AUJinBlink" name="MenuItem">
<fieldValue name="translation" value="24 63.4 0" />
<fieldValue name="textTranslation" value="0 0 0" />
<fieldValue name="description" value="Jin Blink" />
<fieldValue name="menuItemString" value=""JinBlink"" />
<fieldValue name="size" value="40.0 3.0" />
<fieldValue name="fontSize" value="2.4" />
<fieldValue name="spacing" value="1.2" />
<fieldValue name="startTime" />
<fieldValue name="stopTime" />
<fieldValue name="enabled" />
</ProtoInstance>
<ROUTE fromNode="JinBlink_Clock" fromField="fraction_changed"
toNode="AnimationAdapter_JinBlink" toField="set_fraction" />
<ROUTE fromNode="AUJinBlink" fromField="startTime" toNode="JinBlink_Clock"
toField="startTime" />
<ROUTE fromNode="AUJinBlink" fromField="stopTime" toNode="JinBlink_Clock"
toField="stopTime" />
<ROUTE fromNode="AUJinBlink" fromField="enabled" toNode="JinBlink_Clock"
toField="enabled" />
<ProtoInstance DEF="AUJinBrowLowerer" name="MenuItem">
<fieldValue name="translation" value="24 60.4 0" />
<fieldValue name="textTranslation" value="0 0 0" />
<fieldValue name="description" value="Jin Brow Lowerer" />
<fieldValue name="menuItemString" value=""JinBrowLowerer"" />
<fieldValue name="size" value="40.0 3.0" />
<fieldValue name="fontSize" value="2.4" />
<fieldValue name="spacing" value="1.2" />
<fieldValue name="startTime" />
<fieldValue name="stopTime" />
<fieldValue name="enabled" />
</ProtoInstance>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250201/319ee10f/attachment.html>
More information about the x3d-public
mailing list