[x3d-public] I played a little. Re: Scene Access Interface:autogeneratingPython. X3DPSAIL needs support from X3DJSAIL.
John Carlson
yottzumm at gmail.com
Fri Aug 11 12:18:46 PDT 2017
This does raise the question why these large numbers are being generated in
the first place?
Thanks!
John
On Aug 11, 2017 2:41 PM, "Masaki Aono" <aono at tut.jp> wrote:
> Dear John
> I'd appreciate your continuous efforts for the bridge between Java and
> Python.
>
>
> I may be wrong., but I believe the number such as 4278190335 is too large
> for 32-bit integer.
> This is where I think NumPy's 64-bit integer may be needed for
> compatibility (with Java's long)
> https://docs.scipy.org/doc/numpy/user/basics.types.html
>
> I mean wherever Java's long integer is expected,
> Numpy's int64 might be of help.
>
>
> Sincerely,
>
> On 2017/08/12 1:53, John Carlson wrote:
>
> Okay, I’m running make.sh in pythonSAI and collecting errors. One major
> one appears to be in PixelTextureObject.setImage().
>
>
> I get errors like:
>
>
>
> File "rgb_alpha.py", line 120, in <module>
>
> PixelTexture27.setImage([2,2,4,4278190335,4294901760,
> 4294901760,4278190335])
>
> File "jnius\jnius_export_class.pxi", line 900, in
> jnius.JavaMultipleMethod.__call__ (jnius\jnius.c:29079)
>
> jnius.JavaException: No methods matching your arguments
>
>
>
>
>
> Don, can you provide a matching method in X3DJSAIL? Do I need to provide
> hex?
>
> Attached,
>
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Masaki Aono <aono at tut.jp>
> *Sent: *Friday, August 11, 2017 12:30 PM
> *To: *John Carlson <yottzumm at gmail.com>
> *Cc: *Roy Walmsley <roy.walmsley at ntlworld.com>; Don Brutzman
> <brutzman at nps.edu>; Myeong Won Lee <mwlee at suwon.ac.kr>; X3D Graphics
> public mailing list <x3d-public at web3d.org>
> *Subject: *Re: I played a little. Re: Scene Access
> Interface:autogeneratingPython
>
>
>
> Dear John,
>
> Wow, it works (without errors)! Thank you.
>
> CLASSPATH (environment variable) is as follows:
>
> .;./%PYSAIHOME%/saxon9he.jar;%PYSAIHOME%/X3DJSAIL.3.3.classes.jar
>
>
>
> Sincerely
>
>
>
> On 2017/08/12 1:13, John Carlson wrote:
>
> Masaki,
>
>
> Thank you for putting up with errors in my code. I have a new
> HelloWorld.py for you to try. It may work for you, but it doesn’t work for
> me. I get different errors. Could you tell me how you set your CLASSPATH
> to include X3DJSAIL? I think I accidentally removed that from my code.
> Oops!
>
>
>
> Thanks!
>
>
>
> Attached.
>
>
>
> John
>
>
>
> $ python HelloWorld.py
>
> Traceback (most recent call last):
>
> File "HelloWorld.py", line 2, in <module>
>
> from X3Dautoclass import *
>
> File "C:\Users\coderextreme\X3DJSONLD\src\main\python\X3Dautoclass.py",
> line 320, in <module>
>
> X3DObject = autoclass('org.web3d.x3d.jsail.Core.X3DObject')
>
> File "C:\Users\coderextreme\AppData\Local\Programs\Python\
> Python36\lib\site-packages\jnius\reflect.py", line 158, in autoclass
>
> c = find_javaclass(clsname)
>
> File "jnius\jnius_export_func.pxi", line 25, in jnius.find_javaclass
> (jnius\jnius.c:16918)
>
> jnius.JavaException: Class not found b'org/web3d/x3d/jsail/Core/X3DObject'
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *John Carlson <yottzumm at gmail.com>
> *Sent: *Friday, August 11, 2017 11:49 AM
> *To: *Masaki Aono <aono at tut.jp>
> *Cc: *Roy Walmsley <roy.walmsley at ntlworld.com>; Don Brutzman
> <brutzman at nps.edu>; Myeong Won Lee <mwlee at suwon.ac.kr>; X3D Graphics
> public mailing list <x3d-public at web3d.org>
> *Subject: *Re: I played a little. Re: Scene Access Interface:
> autogeneratingPython
>
>
>
> Thanks everyone for looking at my code. I think the issue might be a
> previous set() function defined in the interface returns the interface
> class type, and then a new set function is called on the interface. This
> can be checked by separating the calls to set...() functions into separate
> calls on the numbered on the numbered object, so they are not chained
> together. This can be tested by hand modifying HelloWorld.py and removing
> the chaining and putting each set() call in a separate statement. I will
> try to modify my serializer to do this when I get the chance. I believe a
> previous serializer did do this, and it worked!
>
>
>
> John
>
>
>
> On Aug 11, 2017 11:18 AM, "John Carlson" <yottzumm at gmail.com> wrote:
>
> Masaki, thank you for spending more time with this. I don't think the
> functions will be implemented soon by me. It is complaining about the
> interface, and the functions are defined in the concrete class ...Object
> which implements the interface. I don't think the functions should be
> declared on the interface, but I could be wrong. Don? It is possible that
> a previous set function returns the interface instead of the concrete class
> object, but I think not, last I checked.
>
>
>
> There's something with pyjnius or how X3Dautoclass.py is implemented.
>
>
>
> We really need input from the pyjnius community I think. Or reading of
> various pyjnius documentation.
>
>
>
> I believe my https://GitHub.com/coderextreme/pythonSAI project has the
> beginnings of a pure Python SAI generator that may be worth looking at.
>
>
>
>
>
> On Aug 11, 2017 10:35 AM, "Masaki Aono" <aono at tut.jp> wrote:
>
> Dear John,
>
> Thank you very much.
>
> I think I begin to understand what is happening beneath the HelloWorld.py.
>
> I could partly succeeded in X3D file output with X3D0.setScene(Scene25)
>
> from your HelloWorld.py for the functions already implemented (by pynius?)
> as attached.
>
> Hopefully, missing functions are to be implemented soon.
>
>
>
> When I say "not finding" it means the functions are implemented. See
> X3DJSAIL jsail package.
>
> Sincerely,
>
> ---------------------------------------------------------------
>
> Minor errors I met (other than :ViewpointObject)
>
> AttributeError: 'org.web3d.x3d.sai.Shape.X3DMaterialNode' object has no
> attribute 'setDiffuseColor'
>
> AttributeError: 'org.web3d.x3d.sai.Texturing.X3DTextureNode' object has
> no attribute 'setUrl'
>
> AttributeError: 'org.web3d.x3d.sai.Grouping.Transform' object has no
> attribute 'addChild'
>
>
>
> On 2017/08/11 21:50, John Carlson wrote:
>
>
>
>
>
> On Aug 11, 2017 8:13 AM, "Masaki Aono" <aono at tut.jp> wrote:
>
>
>
> I believe that pyjnius is not finding setCenterOfRotation on
> ViewpointObject.
>
>
>
> John
>
>
>
> >>> Viewpoint28 = ViewpointObject().setDEF("ViewUpClose").
> setCenterOfRotation([0,-1,0]).setDescription("Hello
> world!").setPosition([0,-1,7])
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'org.web3d.x3d.sai.Navigation.X3DViewpointNode' object
> has no attribute 'setCenterOfRotation'
>
>
>
> At this point, I encountered the above error.
>
> It looks like "setCenterOfRotation" may not be in X3DViewpointNode (I may
> be wrong).
>
> Please note that Python 3.6 (which is not Python 2.7) is not a problem
> here, I think.
>
> Sincerely,
>
>
>
> On 2017/08/11 8:11, John Carlson wrote:
>
> Here is HelloWorld.py as generated from my PythonSerializer.js. Note
> that I do not use chained calls.
>
> This is because I was trying to get pyjnius to work. If we had some way of
> getting code like this running, it would be great. I could modify my
> PythonSerializer.js and perhaps include the serializer in X3DJSAIL.
>
>
>
> My JavaScript serializer does not work in X3DJSAIL yet, and I have not
> been working on it since my initial attempt. I have compatible,
> containable changes to the X3DJSAIL stylesheet so that X3DJSAIL should be
> able to generate JavaScript “SAI”/Nashorn application code.
>
>
>
> The problem appears to be getting the JavaScript XML parsers integrated
> with X3DJSAIL. We may be able to use JSON instead: XML -> JSON -> DOM ->
> python. The long way around, instead of XML -> DOM -> python.
>
>
>
> Or we can just use my serializer in JavaScript, and translate JSON -> DOM
> -> python. The XML to JSON would be handled by X3dToJson.xslt (X3DJSAIL).
>
>
>
> I do have examples of Java -> TypeScript and JavaScript, but they don’t
> work.
>
>
>
> I do not have a Java -> Python translator. Good luck finding one.
>
>
>
> John
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Don Brutzman <brutzman at nps.edu>
> *Sent: *Thursday, August 10, 2017 5:31 PM
> *To: *Myeong Won Lee <mwlee at suwon.ac.kr>; Masaki Aono <aono at tut.jp>; Roy
> Walmsley <roy.walmsley at ntlworld.com>; John Carlson <yottzumm at gmail.com>
> *Cc: *X3D Graphics public mailing list <x3d-public at web3d.org>
> *Subject: *Scene Access Interface: autogenerating Python
>
>
>
> Myeong Won Lee and Masaki Aono:
>
>
>
> Thank you for meeting today to discuss X3D Object Model transformation by
> applying an XSLT stylesheet to autogenerate of SAI codebases.
>
>
>
> Myeong Won Lee, I also thought that your Unity HAnim player is wonderful.
> I recommend that you include some examples in the public release, they will
> generate strong interest. Having some public examples while also allowing
> private examples provides appealing choices and the best possible support
> for your students.
>
>
>
> Here is summary excerpted from this week's Web3D meeting report.
>
> ================================================================
>
> 3. Object Model for X3D (OM4X3D)
>
> a. The Object Model for X3D (OM4X3D) is a full set of
> object-oriented interfaces for all nodes, fields and statements in the X3D
> Abstract Specification.
>
> b. OM4X3D is produced by decorating the X3D XML Schema with
> carefully structured annotations that describe the entire object-oriented
> nature of the X3D scene graph. http://www.web3d.org/specifications/OM4X3D/
> ObjectModelForX3dCreation.png
>
> c. Instantiation: Object Model for X3D definitions are
> explicitly listed in X3DObjectModel 3.3.xml with corresponding XML schema
> x3dObjectModel.xsd
>
> d. Ongoing public/private dialog using the x3d-public at web3D.org
> mailing list and presentation at Web3D 2017 Conference has been productive.
> http://www.web3d.org/specifications/OM4X3D/ObjectModelForX3dMasterClassWe
> b3dConference2017June7.pdf
>
> e. Demonstration of strict object model in X3D JSON Encoding,
> which is 98% complete and undergoing extensive review and testing,
> initial-draft specification has been prepared.
>
> f. Initial implementations are available in JavaScript, Java,
> and C++. Also planning to prepare programming-language implementations for
> C, C#.
>
> g. Two new versions for Python are started, with dialog
> occurring to discern best practices.
>
> h. SAI no longer just Script node in Browser object, includes
> full application-oriented API. This will lead to some changes and
> generalizations in 19775-2 Abstract SAI specification.
>
> i. Multiple emerging SAI specifications and implementations
> are shown on updated draft X3D Specifications Relationships diagram
> (attached)
>
> j. Implementation: X3D JSON Loader (X3DJSONLD)
> https://github.com/coderextreme/X3DJSONLD
>
> k. Implementation: X3D Java Scene Access Interface Library
> (X3DJSAIL) http://www.web3d.org/specifications/java/
> X3dJavaSceneAuthoringInterface.html
>
> l. Under consideration: integration into X3D Abstract
> Specification 19775-1 to more thoroughly expand on current abstract
> interface hierarchy.
>
> m. Emerging capability: coherent X3D center, multiple different
> programming languages that offer common design patterns to programmers to
> create identical scene graphs.
>
> ================================================================
>
>
>
> The essence of autogeneration is that proper code patterns must first
> exist. Once we get a few classes with the design patterns of interest, and
> generation of a few classes, then creation of all classes follows in a
> straightforward manner.
>
>
>
> I recommend that the first example we work with is HelloWorld.x3d into .c
> .cpp .cs and .py source.
>
> http://www.web3d.org/x3d/content/examples/HelloWorld.x3d
>
> http://www.web3d.org/x3d/content/examples/HelloWorld.html
>
>
>
> Regarding Python: John Carlson has done intriguing work that
> auto-translates Java source in X3DJSAIL to Python. This is interesting
> because it would keep the codebases closely aligned, making it easier to
> learn and debug. Consistency is easily maintained across X3D versions and
> X3D bugfixes by re-running each distribution. Flexibility is also possible
> since each codebase will include custom utility classes, methods and
> examples.
>
>
>
> Next steps for Python: recommend that we
>
> - Examine Masaki's work and compare it with the pyjnius conversions.
>
> - Autogenerate Python library (X3DPSAIL perhaps?) to provide Python
> codebase support.
>
> - Iterate until we have a good design pattern for HelloWorld and other
> exemplars.
>
> - Create an X3dToPython.xslt stylesheet that can convert someModel.x3d to
> someModel.py source.
>
> - run that across all scenes X3D Example Archives, detect and resolve
> errors, publish builds.
>
> - make T-shirts 8)
>
>
>
> As with JavaScript and Java, it is good to use the x3d-public list for
> this work. Also suitable for a weekly update reports and monthly telcon
> item for X3D Working Group.
>
>
>
> 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 <%28831%29%20656-2149>
>
> X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/
> brutzman
>
>
>
>
>
> --
>
> ******************************************************
>
> 青野雅樹
>
> 豊橋技術科学大学 情報・知能工学系
>
> 知識データ工学・情報検索研究室
>
> 〒441-8580 豊橋市天伯町雲雀ヶ丘1-1
>
> TEL:(0532) <%280532%29> 44-6764
>
> FAX:(0532) 44-6757
>
>
>
> Masaki Aono
>
> Professor
>
> Knowledge Data Engineering Laboratory
>
> Dept. of Computer Science and Engineering
>
> Toyohashi University of Technology
>
> 1-1 Hibarigaoka, Tempaku-cho,
>
> Toyohashi-shi, Aichi 441-8580 JAPAN
>
> TEL: 81+532-44-6764
>
> FAX:81+532-44-6757
>
> email: aono at tut.jp
>
> ******************************************************
>
> --
>
> ******************************************************
>
> 青野雅樹
>
> 豊橋技術科学大学 情報・知能工学系
>
> 知識データ工学・情報検索研究室
>
> 〒441-8580 豊橋市天伯町雲雀ヶ丘1-1
>
> TEL:(0532) <%280532%29> 44-6764
>
> FAX:(0532) 44-6757
>
>
>
> Masaki Aono
>
> Professor
>
> Knowledge Data Engineering Laboratory
>
> Dept. of Computer Science and Engineering
>
> Toyohashi University of Technology
>
> 1-1 Hibarigaoka, Tempaku-cho,
>
> Toyohashi-shi, Aichi 441-8580 JAPAN
>
> TEL: 81+532-44-6764
>
> FAX:81+532-44-6757
>
> email: aono at tut.jp
>
> ******************************************************
>
>
>
>
>
>
>
>
>
> --
>
> ******************************************************
>
> 青野雅樹
>
> 豊橋技術科学大学 情報・知能工学系
>
> 知識データ工学・情報検索研究室
>
> 〒441-8580 豊橋市天伯町雲雀ヶ丘1-1
>
> TEL:(0532) <%280532%29> 44-6764
>
> FAX:(0532) 44-6757
>
>
>
> Masaki Aono
>
> Professor
>
> Knowledge Data Engineering Laboratory
>
> Dept. of Computer Science and Engineering
>
> Toyohashi University of Technology
>
> 1-1 Hibarigaoka, Tempaku-cho,
>
> Toyohashi-shi, Aichi 441-8580 JAPAN
>
> TEL: 81+532-44-6764
>
> FAX:81+532-44-6757
>
> email: aono at tut.jp
>
> ******************************************************
>
>
>
>
> --
> ******************************************************
> 青野雅樹
> 豊橋技術科学大学 情報・知能工学系
> 知識データ工学・情報検索研究室
> 〒441-8580 豊橋市天伯町雲雀ヶ丘1-1TEL:(0532) <(0532)> 44-6764
> FAX:(0532) 44-6757
>
> Masaki Aono
> Professor
> Knowledge Data Engineering Laboratory
> Dept. of Computer Science and Engineering
> Toyohashi University of Technology
> 1-1 Hibarigaoka, Tempaku-cho,
> Toyohashi-shi, Aichi 441-8580 JAPAN
> TEL: 81+532-44-6764
> FAX:81+532-44-6757
> email: aono at tut.jp
> ******************************************************
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170811/3e2a440e/attachment-0001.html>
More information about the x3d-public
mailing list