[x3d-public] New Python API (with package imports)

John Carlson yottzumm at gmail.com
Tue Apr 9 12:12:45 PDT 2019


I am changing the imports in the Python API to narrow the amount of 1) memory consumed, I think 2) reduce namespace hogging. 3) increase the number of file descriptors used, perhaps

I am not sure about performance or not, but the old way of doing it remains, so we can test.

Thus the front of your code will look something like

import classpath
from org.web3d.x3d.jsail.Core.X3DObject import X3DObject as X3D
from org.web3d.x3d.jsail.Core.headObject import headObject as head
from org.web3d.x3d.jsail.Core.metaObject import metaObject as meta
from org.web3d.x3d.jsail.Core.SceneObject import SceneObject as Scene
from org.web3d.x3d.jsail.Core.ProtoDeclareObject import ProtoDeclareObject as ProtoDeclare
from org.web3d.x3d.jsail.Core.ProtoInterfaceObject import ProtoInterfaceObject as ProtoInterface
from org.web3d.x3d.jsail.Core.ProtoBodyObject import ProtoBodyObject as ProtoBody
from org.web3d.x3d.jsail.Core.ProtoInstanceObject import ProtoInstanceObject as ProtoInstance
from org.web3d.x3d.jsail.Core.ISObject import ISObject as IS
from org.web3d.x3d.jsail.Core.connectObject import connectObject as connect
from org.web3d.x3d.jsail.Core.fieldObject import fieldObject as field
from org.web3d.x3d.jsail.Core.fieldValueObject import fieldValueObject as fieldValue
from org.web3d.x3d.jsail.Shape.ShapeObject import ShapeObject as Shape
from org.web3d.x3d.jsail.Geometry3D.SphereObject import SphereObject as Sphere
from org.web3d.x3d.jsail.Geometry3D.CylinderObject import CylinderObject as Cylinder
from org.web3d.x3d.jsail.Geometry3D.BoxObject import BoxObject as Box
from org.web3d.x3d.jsail.Grouping.TransformObject import TransformObject as Transform
…

And the rest should remain the same.  We still need to generate the example source files with from’s… and classpath import.  This is going to be a trick if I pull this off. I think the trick will be figuring out some logic to find the correct package hierarchy for imports, hopefully for JavaScript, like creating a JSON object which has a key of class name, and a value of the fully qualified class name that I can use to easily look up element tags from an X3D DOM data structure.  I already have a shell script that does this to write the python classes, I just need to play with it some to create the JSON.   Great!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190409/87243489/attachment.html>


More information about the x3d-public mailing list