[x3d-public] X3D Python binding X3DPSAIL progress: pyJNIus problem isolated

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Sat May 18 06:14:18 PDT 2019

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.

	Viewpoint().setDEF("ViewUpClose").setCenterOfRotation(0,-1,0).setDescription("Hello world!").setPosition(0,-1,7)

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>
     .addChild(Viewpoint().setDEF("ViewUpClose").setCenterOfRotation(0,-1,0).setDescription("Hello world!").setPosition(0,-1,7))
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

More information about the x3d-public mailing list