[x3d-public] X3D APIS for Qt, Python, ECMAScript

John Carlson yottzumm at gmail.com
Tue Mar 3 11:56:03 PST 2020


I think we may just need to figure out when "this[nodeName]" should be
used, and when just "this" should be used.  There's probably a few well
known classes where nodeName is not used (meta, etc.).   By all means,
collect this list and let me know, or modify the JavaScriptSerializer.js
(under www.web3d.org/x3d/stylesheets/node,  Line 246 -- or search for fcode
(the last reference)

On Tue, Mar 3, 2020 at 1:47 PM John Carlson <yottzumm at gmail.com> wrote:

> Output is much improved.  A careful eye may be required to spot some
> problems.
>
> Output file (run it or ant to get JSON output) is:
> www.web3d.org/x3d/stylesheets/node/examples/HelloWorldProgramOutput.js
>
> Thanks,
>
> John
>
>
> On Tue, Mar 3, 2020 at 12:47 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> I have updated the JavaScriptSerializer.js  There is now JSON output from
>> running the program (not a file yet).
>>
>> We are missing "tags" from the serialized JSON output from toFileJSON().
>>  Search for options in JavaScriptSerializer.js -- found in
>> www.web3d.org/x3d/stylesheets/node on sourceforge. I am not quite sure
>> how to fix this, except for printing the function name, or passing the node
>> name.
>>
>> I'm a bit confused right now, maybe Andreas or Don can peek at my code
>> generation. There's two aspects to code generation...first the class
>> constructors are printed, then the scenegraph. The top level scenegraph
>> object has two functions for stringifying the JSON current (will eventually
>> probably will want to print XML).
>>
>> Hopefully, a small modification will get this code working properly.
>>
>> John
>>
>> On Tue, Mar 3, 2020 at 12:22 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> I currently add @, - in the constructor.
>>>
>>> On Tue, Mar 3, 2020 at 12:20 PM John Carlson <yottzumm at gmail.com> wrote:
>>>
>>>> Don, would this be an appropriate set of calls for  a node.js
>>>> scenegraph?
>>>>
>>>>             new TouchSensor({"@description":"within ProtoBody"},[,
>>>>               new IS({},[,
>>>>                 new
>>>> connect({"@nodeField":"description","@protoField":"description"},[]),
>>>>                 new
>>>> connect({"@nodeField":"enabled","@protoField":"enabled"},[])])])])]),
>>>>
>>>> Or should i append the @, -, etc in the constructor?
>>>>
>>>> John
>>>>
>>>> On Mon, Mar 2, 2020 at 2:24 PM John Carlson <yottzumm at gmail.com> wrote:
>>>>
>>>>> Also, see this example of the beginnings of a class hierarchy for
>>>>> X3DESAIL, plus a scenegraph (combined for efficiency).
>>>>>
>>>>>
>>>>> https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/node/examples/HelloWorldProgramOutput.js
>>>>>
>>>>> Good luck!
>>>>>
>>>>>
>>>>> On Mon, Mar 2, 2020 at 2:17 PM John Carlson <yottzumm at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> You might be considering this?
>>>>>>
>>>>>>
>>>>>> https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/DOM2JSONSerializer.js
>>>>>>
>>>>>>
>>>>>> That's how I translate DOM documents to JSON.
>>>>>>
>>>>>> I am unclear on how to map X3D JSON onto any kind of class hierarchy,
>>>>>> such that X3D JSON dumps out with JSON.stringify.
>>>>>>
>>>>>> This JS is not very well tested, but produced the same result as the
>>>>>> stylesheet on the JSON I tested.
>>>>>>
>>>>>> John
>>>>>>
>>>>>> On Mon, Mar 2, 2020 at 2:02 PM John Carlson <yottzumm at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> No, X3DJSONLD.ts is already part of X3DTSSAIL.
>>>>>>>
>>>>>>> I think what you folks want is in X3DTSSAIL, or something totally
>>>>>>> different from X3DJSONLD.  It would not be in the purpose of X3DJSONLD to
>>>>>>> provide X3DESAIL.
>>>>>>>
>>>>>>> If you want to pursue a JSON scenegraph, then either modify X3DJSAIL
>>>>>>> to provide it, or write X3duomToX3dESPackage.xslt  similar to the python
>>>>>>> stylesheet.  I am not a stylesheet programmer.  What I can do is provide a
>>>>>>> sample ECMAScript class implementing one part of X3DESAIL, so that the
>>>>>>> pattern may be followed.
>>>>>>>
>>>>>>> Here are the requirements I see:
>>>>>>>
>>>>>>> 1. Provide  a JSON scenegraph API
>>>>>>> 2. Provide a TypeScript scenegraph API
>>>>>>>
>>>>>>> May I suggest that we don't need a JSON API?  That's already in
>>>>>>> ECMAScript, guys.   What might be needed I think can be found in route.js
>>>>>>> under X3DJSONLD/src/main/node/route.js (check it out).
>>>>>>>
>>>>>>> For the TypeScript API, checkout the repository:
>>>>>>> https://github.com/coderextreme/JavaSceneAuthoringInterfaceLibrary when
>>>>>>> you run maven, it should leave files in target/ts.
>>>>>>>
>>>>>>> Also, please checkout the nashorn version of X3DJSAIL already on
>>>>>>> sourceforge.  *The thing that's missing here is a node.js version.
>>>>>>> I started something under www.web3d.org/x3d/stylesheets/node
>>>>>>> <http://www.web3d.org/x3d/stylesheets/node>, but it's incomplete. I have
>>>>>>> modifications that I haven't checked in yet.*
>>>>>>> This was something that skipped my mind.
>>>>>>>
>>>>>>> The basic interface is to have a "node" constructor that takes a
>>>>>>> object for attributes, and an array for children.
>>>>>>>
>>>>>>> Good luck!
>>>>>>>
>>>>>>> John
>>>>>>>
>>>>>>> On Mon, Mar 2, 2020 at 1:26 PM John Carlson <yottzumm at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Do we want to add X3DJSONLD.java to X3DTSSAIL?   Is that what I’m
>>>>>>>> missing?
>>>>>>>>
>>>>>>>> On Mon, Mar 2, 2020 at 1:18 PM John Carlson <yottzumm at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Here is X3DTSSAIL:
>>>>>>>>>
>>>>>>>>> https://coderextreme.net/X3DTSSAIL.zip
>>>>>>>>>
>>>>>>>>> Does this satisfy the desire for ECMAscript, or do we want a
>>>>>>>>> native JSON scenegraph?   Can we add it to X3DJSAIL?   We should be able to
>>>>>>>>> extract JSON and parse JSON already?   I think?   Do you need examples?
>>>>>>>>>
>>>>>>>>> I will spend some time looking at x3d.py generation.
>>>>>>>>>
>>>>>>>>> John
>>>>>>>>>
>>>>>>>>> On Mon, Mar 2, 2020 at 8:44 AM Don Brutzman <brutzman at nps.edu>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi John.  Can we meet via phone some time this week to discuss?
>>>>>>>>>> Happy to learn more and support as able.
>>>>>>>>>>
>>>>>>>>>> 1. X3D Unified Object Model (X3DUOM) is a thorough representation
>>>>>>>>>> of X3D scene graph.  If something needs to be added, can consider that.
>>>>>>>>>>
>>>>>>>>>> Qt is cross platform, seems to have C++ innards similar to
>>>>>>>>>> primary python distribution.
>>>>>>>>>>
>>>>>>>>>> I found your work as follows but not sure what to do with it:
>>>>>>>>>>
>>>>>>>>>> https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/examples/gui.py
>>>>>>>>>>
>>>>>>>>>> https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/examples/gui.x3d
>>>>>>>>>>
>>>>>>>>>> Wondering what the project's primary goal is, writing a new LGPL
>>>>>>>>>> X3D scene editor in Qt?  Or nonrendering API X3DQtSAIL?
>>>>>>>>>>
>>>>>>>>>> Or perhaps you are thinking of something that adds X3D to the
>>>>>>>>>> following project?
>>>>>>>>>>
>>>>>>>>>> * The Future of Qt 3D
>>>>>>>>>>    https://www.qt.io/blog/the-future-of-qt-3d
>>>>>>>>>>
>>>>>>>>>> * Qt 3D Studio 2.6 Released
>>>>>>>>>>    https://www.qt.io/blog/qt-3d-studio-2.6-released
>>>>>>>>>>
>>>>>>>>>> * Qt 3D Studio Manual
>>>>>>>>>>    https://doc.qt.io/qt3dstudio/index.html
>>>>>>>>>>    https://doc.qt.io/qt3dstudio/3d-assets.html
>>>>>>>>>>    https://doc.qt.io/qt3dstudio/graphics.html
>>>>>>>>>>
>>>>>>>>>> ---
>>>>>>>>>>
>>>>>>>>>> 2. Python concern: shouldn't your new work be a separate project
>>>>>>>>>> to avoid creating problems and synchronization difficulties in the current
>>>>>>>>>> project in the /stylesheets/python directory.  This would let x3d.py evolve
>>>>>>>>>> without unintended clobbers emerging in the future.
>>>>>>>>>>
>>>>>>>>>> Am also thinking we should finally rename the X3D Python Package
>>>>>>>>>> to X3DPSAIL, matching X3DJSAIL both in acronym and concept since it already
>>>>>>>>>> matches in functionality.  Probably long overdue.  We also now have time to
>>>>>>>>>> write a paper for Web3D 2020 since the conference was postponed to November.
>>>>>>>>>>
>>>>>>>>>> ---
>>>>>>>>>>
>>>>>>>>>> 3. Next: also had a old+new idea to consider following recent
>>>>>>>>>> discussion with Katie Unger of Synergy Software Design (cc:ed).  What if we
>>>>>>>>>> used X3DUOM and autogenerated an ECMAScript SAI for X3D called X3DESAIL
>>>>>>>>>> that patterned X3D scene graph accessors following your X3DJSONLD patterns,
>>>>>>>>>> was primarily oriented towards Node.js, and also added utility methods
>>>>>>>>>> facilitating use in combination with X3DOM X_ITE and Three.js.  That
>>>>>>>>>> harmonization might be something widely useful.
>>>>>>>>>>
>>>>>>>>>> TIA for your efforts, as always best wishes for your work.
>>>>>>>>>>
>>>>>>>>>> v/r Don
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 3/1/2020 3:02 PM, John Carlson wrote:
>>>>>>>>>> > I have added gui.x3d and gui.py as examples of translating Qt
>>>>>>>>>> Designer XML (I think) to "X3D"-like python.  This is after a "roll my own"
>>>>>>>>>> xmltopy.py.  There's still a lot of work to do, namely, we need to add some
>>>>>>>>>> text node processing to X3dToPython.xslt.   We probably want to create a
>>>>>>>>>> RpgToPython.xslt for that.
>>>>>>>>>> >
>>>>>>>>>> > I also added a build target for gui.py.
>>>>>>>>>> >
>>>>>>>>>> > Ideally, either Jeff or I will write the RpgToPython.xslt and
>>>>>>>>>> associated RPGuomToRpgPythonPackage.xslt.
>>>>>>>>>> >
>>>>>>>>>> > Any inputs everyone has are welcome, especially in the realm of
>>>>>>>>>> creating a user friendly editor for RPGUOM like Qt Designer/WxFormBuilder.
>>>>>>>>>> >
>>>>>>>>>> > Code is found here on sourceforge:
>>>>>>>>>> >
>>>>>>>>>> > x3d-code/www.web3d.org/x3d/stylesheets/python <
>>>>>>>>>> http://www.web3d.org/x3d/stylesheets/python>
>>>>>>>>>> >
>>>>>>>>>> > Thanks for all the contributions that made this project even
>>>>>>>>>> possible!
>>>>>>>>>> >
>>>>>>>>>> > John
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>> > If someone wants to contribute XMLSchemas or X3DUOM-like
>>>>>>>>>> unified object models which support Qt Designer and/or RPG object model,
>>>>>>>>>> they would be most welcome.
>>>>>>>>>> >
>>>>>>>>>> > I'll probably be working on an RPGUOM next.
>>>>>>>>>> >
>>>>>>>>>> > John
>>>>>>>>>>
>>>>>>>>>> all the best, Don
>>>>>>>>>> --
>>>>>>>>>> Don Brutzman  Naval Postgraduate School, Code USW/Br
>>>>>>>>>> brutzman at nps.edu
>>>>>>>>>> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
>>>>>>>>>>  +1.831.656.2149
>>>>>>>>>> X3D graphics, virtual worlds, navy robotics
>>>>>>>>>> http://faculty.nps.edu/brutzman
>>>>>>>>>>
>>>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200303/d47fedde/attachment-0001.html>


More information about the x3d-public mailing list