[x3d-public] X3DJSAIL updated support for setting with doubles; python pyjniusmapping

John Carlson yottzumm at gmail.com
Sat May 11 19:44:35 PDT 2019

Navigation/ViewpointObject.java:        public final ViewpointObject setDEF(String newValue)
Navigation/ViewpointObject.java:        public ViewpointObject setDEF(SFStringObject newValue)
Navigation/X3DViewpointNode.java:       public X3DViewpointNode setDEF(String newValue);

The only thing I can conclude is that somehow, the setDEF in X3DViewpointNode.java overrides the one in ViewpointObject.java.  Since the interface contract for setDEF returns an interface or abstract class, the method can’t be found.  I “patched’ this by wrapping in a SFStringObject, and there’s no interface contract for that method, so it chooses the concrete class.

Reflect.py travels up the inheritance hierarchy doing this:

       parent_class = parent_class.getSuperclass()

I think it’s overriding methods with one of these, but not sure:
       classDict[name] = cls(sig, varargs=varargs)

       classDict[lowername] = (lambda n: property(lambda self: getattr(self, n)()))(name)

       classDict[name] = JavaMultipleMethod(signatures)
My guess is it overrides with the first one, since there is only one method in the interface/abstract class.

But it will require some experimentation.

You can replace import jnius with import reflect in classpath.py, I think, or each individual org package .py file.

I’ve tried disabling the getSuperclass line without success

Next step might be figure out how to build pyjnius.


>5. we're still having trouble with pyjnius finding the appropriate method:

- - - - - -
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\X3dForWebAuthors/Chapter01TechnicalOverview//HelloWorld.py", line 74, in <module>
     .addChild(Viewpoint().setDEF("ViewUpClose").setCenterOfRotation([0,-1,0]).setDescription("Hello world!").setPosition([0,-1,7]) \
AttributeError: 'org.web3d.x3d.sai.Navigation.X3DViewpointNode' object has no attribute 'setCenterOfRotation'
- - - - - -

As before, not clear why parent X3DViewpointNode object gets tagged.   Suspect it is because pyjnius can't find the correct method signature in ViewpointObject, and so goes to parent abstract class.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190511/79cd9edb/attachment-0001.html>

More information about the x3d-public mailing list