[x3d-public] good example for ECMAScripting and Protos?

John Carlson yottzumm at gmail.com
Sat Aug 4 02:03:57 PDT 2018


Here’s my current code for clearing the ECMAScript out of a X3D file so that it doesn’t show on the screen:


                       $(selector+" Script").contents().filter(function () {
                            return this.nodeType === 3 || this.nodeType === 4;
                       }).remove();

This retains the fields.  I may change my code to work with fields instead of parsing out the fields into properties (but directOutput is nice).  This would mean that X3DOM has to route to and from the script fields (is this possible?).

John
Sent from Mail for Windows 10

From: John Carlson
Sent: Saturday, August 4, 2018 4:56 AM
To: vmarchetti at kshell.com; X3D-Public; x3dom mlist; Andreas Plesch
Subject: RE: [x3d-public] good example for ECMAScripting and Protos?

I have a problem with this file in X3DOM, because as far as I can tell, the SFNode fields (the node, not the field) do not have getFieldValue for point etc. as a function, for example (but one can double check me).  In other words, I don’t think this node is an X3DOM node.

Thus I cannot take a reasonable length in the script.  One would have to parse the string.

That’s as clear as I can get.  I think this might be because x3dom does not process scripts correctly. We would need a script tag handler, and a field handler inside that.

Can you help Andreas?  I’ve created a script tag before, but that code is lost. It might be in my GitHub repository somewhere, not sure.

We just need a script tag that has fields, but doesn’t execute its CDATA section.  I am pretty sure

How is V4.0 handling this?

Alternatively, I can change my nodeUtil code to look at the type and do the right thing converting a string to the correct type.   Suggestions are welcome.

Thanks for the great example, Vince,

Should I adapt my code to deal with this failing in X3DOM, or should we change X3DOM?

John

Sent from Mail for Windows 10

From: vmarchetti at kshell.com
Sent: Wednesday, August 1, 2018 9:04 PM
To: John Carlson; X3D-Public
Subject: Re: [x3d-public] good example for ECMAScripting and Protos?

See 
http://www.kshell.com/pages/pointcloudvisualization/SphereDirectedPointSet.x3d

It is a X3D file with with a Prototype + ecmascript definition of a point cloud, with a vector attached to each point of the cloud.
Example used is just points randomly distributed on sphere with directs pointed radially outward.

Potential uses would be to implement the scanning design pattern at http://x3dgraphics.com/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPatternIndex.html , or
visualizing fluid flow or  electromagnetic field

On Jul 31, 2018, at 10:30 PM, John Carlson <yottzumm at gmail.com> wrote:

Is there a good example of ECMAScripting in X3D that I can use to test my X3D JSON ECMAScript preprocessor?  Preferably with Protos 
 
 
Thanks!
 
John
 
_______________________________________________
x3d-public mailing list
x3d-public at web3d.org
http://web3d.org/mailman/listinfo/x3d-public_web3d.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180804/672d802d/attachment-0001.html>


More information about the x3d-public mailing list