[x3d-public] python pyjnius mapping

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Tue May 14 22:48:51 PDT 2019


1. [concept calibration, ensuring we are on the same sheet of music]

On 5/14/2019 4:58 AM, John Carlson wrote:
> My version of the pipeline serializer clears up 130 of your problems in the interfaces.  My abstract classes error almost seems trivial, with only 2 sources, that I could determine, potentially clearing up 10s of problems.

Not sure what you mean here.  We are working with two mappings that your software creates, all designed cooperatively.

For the problem method, the first encoding is:

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

while the second pipelined programming approach is:

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

These are equivalent, indeed we are compiling against the same X3DJSAIL in each case.

The first works with no complaint because the return values of each method invocation is ignored.  Thus the incorrect return type for setCenterOfRotation(0,-1,0) does not matter.

I think that the second fails because Python/pyjnius is finding an incorrect return type for setCenterOfRotation(0,-1,0) which the subsequent setDescription("Hello world!") can't be applied to.

Traceback (most recent call last):
   File "HelloWorld.future.py", line 54, 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'

oh no, that is not correct!  it is the setDEF() method that returns the incorrect return type, which the subsequent setCenterOfRotation(0,-1,0) can't operate on.

OK so that gets me closer to understanding what you were saying about setDEF.

Similar issue:  ViewpointObject setDEF() is an @Override method.

	@Override
	public final ViewpointObject setDEF(String newValue)

i'll take a deeper look at setDEF() lineage next time.

-----------------

2. meanwhile tonight, i mistakenly deleted the org/* tree from the pyjnius directory.

ran makeorg.sh to restore it. console attached.

not sure what happened next, it appeared to break classes.json:

================================================================================
create python:
node xml2all.js HelloWorld.x3d
================================================================================
File: HelloWorld.x3d
Error: SyntaxError: Unexpected token } in JSON at position 47595
     at JSON.parse (<anonymous>)
     at PythonSerializer.serializeToString (C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\python\pyjnius\PythonSerializer.js:43:23)
     at serializeXML (C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\python\pyjnius\convertXML.js:26:25)
     at convertXML (C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\python\pyjnius\convertXML.js:55:16)
     at Object.<anonymous> (C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\python\pyjnius\xml2all.js:10:1)
     at Module._compile (internal/modules/cjs/loader.js:701:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
     at Module.load (internal/modules/cjs/loader.js:600:32)
     at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
     at Function.Module._load (internal/modules/cjs/loader.js:531:3)

C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\python\pyjnius\convertXML.js:67
				throw("Wrote nothing, serializer returned nothing");
				^
Wrote nothing, serializer returned nothing
Result: 1
================================================================================

i restored classes.json via subversion and that seemed to fix things again.  not sure why makeorg failed though.

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 embedded and charset-unspecified text was scrubbed...
Name: makeorg.out.txt
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190515/57036aa2/attachment-0001.txt>


More information about the x3d-public mailing list