[x3d-public] Simple example of X3DConcreteNode/addChild problem

John Carlson yottzumm at gmail.com
Wed May 15 09:53:16 PDT 2019

This issue doesn’t have anything to do with setDEF.

Please address this problem after setDEF.  Thanks, Don!

There’s probably more than one setIS or something like that.

Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, May 14, 2019 11:33 AM
To: Don Brutzman; X3D Graphics public mailing list; aono at tut.jp
Subject: Simple example of X3DConcreteNode/addChild problem

Example of error generated below.  (minimal amount of code) Jupyter export attached.  I hope you can address the issue sometime with X3DJSAIL.  My best guess is that pyjnius is going through getSuperclass() and finding the abstract classes’ method setIS().  We can try deleting getSuperclass call in pyjnius if you think it’s appropriate.
My suggestion is to delete setIS from X3DConcreteNode.java or implement addChild in X3DConcreteNode.java, which may just cascade the error.  I think deleting setIS might be preferable, but test both cases.   Consider a wrapping, like:

Transform(Transform().setIS(IS())).addChild(Shape())  # hasn’t been tested, but ew.

A jnius.cast would work similarly.  We can go with a cast if you like.  Please look into a cast to see what you prefer.  Also, try converting to Java.

Now do you see where the abstract class is coming from?  Do you agree on what’s introducing the abstract class (not me)?

Good news is, I and Michael figured out how to run the code in Jupyter Lab (anaconda).  There are instructions online that work with the conda.bat command install jnius (see conda install on pyjnius website)  WooHoo! Highly recommended, but a bit stilted to start with.

Code is back to you! Looking for changes to X3DConcreteNode.java.  I can make changes to the serializer if we decide wrapping or casting is appropriate.  I just think we’ll be wrapping the wrapping the wrapping.  It seems better to me to add or delete abstract methods.

No, I don’t know why @Override didn’t work.
# This code shows the error
import jnius_config
jnius_config.set_classpath('.', 'c:/x3d-code/www.web3d.org/x3d/stylesheets/java/jars/X3DJSAIL.3.3.full.jar')

from jnius import autoclass
Shape = autoclass('org.web3d.x3d.jsail.Shape.ShapeObject')
Transform = autoclass('org.web3d.x3d.jsail.Grouping.TransformObject')
IS = autoclass('org.web3d.x3d.jsail.Core.ISObject')

AttributeError                            Traceback (most recent call last)
<ipython-input-1-62dabff95a4e> in <module>
---> 10 Transform().setIS(IS()).addChild(Shape())

AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'addChild'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190515/94948727/attachment.html>

More information about the x3d-public mailing list