[x3d-public] X3D Python binding X3DPSAIL progress: pyJNIus problem isolated
yottzumm at gmail.com
Sat May 18 06:20:39 PDT 2019
Reflect.py is copied from the pyjnius source. I recommend going to the pyjnius source under the kivy user on GitHub. If you want to review the mapping between python and java, you’re welcome, but I don’t expect you to find anything interesting (but maybe there could be a bug there, I’ve not looked).
I’m one step ahead of you. Look at recent email where I suggest returning self instead of the return normal value of the JavaMethod. I will repost.
Sent from Mail for Windows 10
From: Brutzman, Donald (Don) (CIV)
Sent: Saturday, May 18, 2019 8:14 AM
To: John Carlson; X3D Graphics public mailing list
Subject: X3D Python binding X3DPSAIL progress: pyJNIus problem isolated
1. Have committed several fixes and produced a new build of X3DJSAIL, uploaded updated python examples for X3D Example Archives.
- - -
2. Latest work refactored setDEF() and setUSE() methods. There is no way to invoke them incorrectly. Local use with a concrete node explicitly calls the protected superclass.
For example, in Java, the following pipelined methods always return the same updated ViewpointObject so that subsequent invocations are possible.
new ViewpointObject().setDEF("ViewUpClose").setDescription("Hello world!").setCenterOfRotation(0.0f,-1.0f,0.0f).setPosition(0.0f,-1.0f,7.0f))
The nearly identical call in Python should work exactly the same, if pyjnius mappings are correct. However it fails. Invocation and Python log excerpt follow.
Loading HelloWorld.py (pipeline syntax) with python, if successful then saving and validating as HelloWorld_RoundTrip2.x3d version:
Traceback (most recent call last):
File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling/HelloWorldScenes//HelloWorld.py", line 54, in <module>
AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'setCenterOfRotation'
The Python traceback above is misdirecting but close scrutiny nevertheless reveals the problem. The .setCenterOfRotation() method should have been found on the pipelined ViewpointObject. Instead, pyjnius is mistakenly looking at superclass org.web3d.x3d.jsail.X3DConcreteNode. That shouldn't happen.
The first hundred or so of the remaining errors in the build log are all attributable to this same error. This same explanation applies to the .addChild() issues you've looked at, John.
Having pushed the pyjnius error around, am positive that there is no way to work around it in X3DJSAIL. Nor would we want to break a strict object-oriented design to accommodate a mistake in a secondary implementation.
So, not fixed yet, but appears to be fully isolated as a problem in our pyjnius mapping, or possibly pyjnius itself.
- - -
3. Specifically the error has to do with pyjnius preferentially looking for a superclass, rather than the object itself as specified, when returning a value from a method.
Recommend we next torment the X3D pyjnius binding you've created for further troubleshooting.
Once were fully confident about that, the problem is either (a) fixed, or (b) isolated to pyjnius itself.
So where do we go next, reflect.py?
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...
More information about the x3d-public