-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion about declaratively modifying routes. #1
Comments
@create3000 says: It is not all official SAI but X_ITE has internally and official these route functions:
1 and 2 are standard. Discussing declarative syntax can also be done in an issue(s), this has a lot of advantages. Think you all know GitHub issues. |
So my thought is that an editor or authoring system already provides ways to update route fields. Can we take the route features of an authoring system, and make them available in XML or VRML syntax? |
With DOM integration you can find routes like you would do find any HTMLElement, with native DOM methods or maybe jQuery: |
We’re also hoping to make this feature available in castle-engine and view3dscene. So portability of scripts is an issue. This is not really an SAI/DOM discussion, but yes, SAI or DOM will implement the features we do to the scene, so SAI modications are probably first |
From my original post, I suggested that a fraction from [0,1] would map to integers which would map to a position in an MFString. The MFString would potentially update a ROUTE. |
Say I want to take a [0,1] fraction key and map it to an MFString keyValue. How do I do that in X3D? This might be used for alternating Text nodes, or ROUTEs, see below. Also, can I take a similar key fraction and map to keyValue MFNodes? I realize that Switch plus and ScalarInterpolator would satisfy the latter. I’m not clear on how to do the former. This would be key to sending events to ROUTEs, changing the from/to node names and fields. This seems like a very powerful feature! I just don’t know how to route SFString events to route statements. Is there an alternative? Maybe I should create an Uber X3D? Can we add DEF and name to ROUTEs, and make them first class nodes? I’m not sure how performant this would be, or even how implementable it is. |
I’m also thinking of a TextInterpolator where one one SFString morphs into another … |
So there’s some discussion about using an id attribute (CSS) to update a route. So one would use CSS instead of a sequencer or interpolator to change values instead of SAI or DOM. Hmm! |
For reference, here’s the code bloat I’m trying to reduce. I’ve got 4 files of this. https://github.com/coderextreme/jaminate/blob/main/Jaminate/app/src/main/javascript/takes.John.txt the timings in each file are slightly different. |
Here’s what I generate the 4 files with: https://github.com/coderextreme/jaminate/blob/main/Jaminate/app/src/main/javascript/takes.js (I know, lots of commented out code) |
I only need the characters, moves per character, and times per character arrays to generate the code bloat. I’m looking for a quicker load time. https://github.com/coderextreme/jaminate/blob/main/Jaminate/app/src/main/javascript/John.json |
If there’s an easier way to do this, I’m all ears |
One solution may be to write 2 scripts, one like takes.js and the other in castle script |
What about this prototype? Set names of nodes and field names, then toggle enabled: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'>
<head>
<component name='Scripting' level='1'/>
</head>
<Scene>
<ProtoDeclare name='Route'>
<ProtoInterface>
<field accessType='inputOutput' type='SFBool' name='connected'/>
<field accessType='inputOutput' type='SFNode' name='sourceNode'/>
<field accessType='inputOutput' type='SFString' name='sourceField'/>
<field accessType='inputOutput' type='SFNode' name='destinationNode'/>
<field accessType='inputOutput' type='SFString' name='destinationField'/>
</ProtoInterface>
<ProtoBody>
<Script DEF='RouteScript'>
<field accessType='inputOutput' type='SFBool' name='connected'/>
<field accessType='inputOutput' type='SFNode' name='sourceNode'/>
<field accessType='inputOutput' type='SFString' name='sourceField'/>
<field accessType='inputOutput' type='SFNode' name='destinationNode'/>
<field accessType='inputOutput' type='SFString' name='destinationField'/>
<IS>
<connect nodeField='connected' protoField='connected'/>
<connect nodeField='sourceNode' protoField='sourceNode'/>
<connect nodeField='sourceField' protoField='sourceField'/>
<connect nodeField='destinationNode' protoField='destinationNode'/>
<connect nodeField='destinationField' protoField='destinationField'/>
</IS>
<![CDATA[ecmascript:
let route;
function initialize ()
{
set_connected ();
}
function set_connected ()
{
const scene = Browser .currentScene;
if (connected)
{
if (!sourceNode || !sourceField)
return;
if (!destinationNode || !destinationField)
return;
route = scene .addRoute (sourceNode, sourceField, destinationNode, destinationField);
}
else if (route)
{
scene .deleteRoute (route);
}
}
]]>
</Script>
</ProtoBody>
</ProtoDeclare>
</Scene>
</X3D> |
I found Browser.addRoute and Browser.deleteRoute. Work great.
AFAIK, BS Contact does not like global variables. Especially ones starting
with let. I may have an old version.
John
…On Fri, Dec 13, 2024 at 3:36 AM Holger Seelig ***@***.***> wrote:
What about this prototype? Set names of nodes and field names, then toggle
enabled:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
<X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'>
<Scene>
<ProtoDeclare name='Route'>
<ProtoInterface>
<field accessType='inputOutput' type='SFBool' name='enabled'/>
<field accessType='inputOutput' type='SFString' name='sourceNode'/>
<field accessType='inputOutput' type='SFString' name='sourceField'/>
<field accessType='inputOutput' type='SFString' name='destinationNode'/>
<field accessType='inputOutput' type='SFString' name='destinationField'/>
</ProtoInterface>
<ProtoBody>
<Script DEF='RouteScript'>
<field accessType='inputOutput' type='SFBool' name='enabled'/>
<field accessType='inputOutput' type='SFString' name='sourceNode'/>
<field accessType='inputOutput' type='SFString' name='sourceField'/>
<field accessType='inputOutput' type='SFString' name='destinationNode'/>
<field accessType='inputOutput' type='SFString' name='destinationField'/><![CDATA[ecmascript:let route;function initialize (){ set_enabled ();}function set_enabled (){ if (!sourceNode) return; if (!sourceField) return; if (!destinationNode) return; if (!destinationField) return; const scene = Browser .currentScene; if (enabled) { route = scene .addRoute (scene .getNamedNode (sourceNode), sourceField, scene .getNamedNode (destinationNode), destinationField); } else if (route) { scene .deleteRoute (route); }}]]>
</Script>
</ProtoBody>
</ProtoDeclare>
</Scene>
</X3D>
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFMJ53DIDH65DP6KIUDOWD2FKTDLAVCNFSM6AAAAABTRS6EMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBQHE4TIMBVGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Tag yourself in this issue to get emails. Add a comment.
Note that this is enough of a modification that forking may be considered. Or at least, development off the main branch.
The text was updated successfully, but these errors were encountered: