[x3d-public] python pyjnius mapping

John Carlson yottzumm at gmail.com
Wed May 15 00:23:09 PDT 2019


When I run my version of the pipelining serializer, I uncomment the code that inserts wrappers and comment out your code.  That is all.

I can double check my results, but here are the totals I got last time, albeit a bit adhoc:
Don’s style: No wrappers
As of 1 or 2 days ago followed by today if present.
Remaining interface errors: 133; 123 today
Remaining abstract class errors:  1; same today
Remaining stack overflow errors: 13 or so; 51  today
Total validations: 538; today 539
Future.py validations: 268
 
John’s style: Add wrappers (what Don calls typecasting) results:
 Remaining interface errors: 3 (invalid instance passed; 0 today
Remaining abstract class errors:16 (no attribute addChild on X3DConcreteNode); 16 today
Remaining stack overflow errors: 61; 61 today

Could it be that my constructor parameters are off?

How much memory are you using on stack?

It looks like you fixed some!  Hurrah.
John

Sent from Mail for Windows 10

From: Brutzman, Donald (Don) (CIV)
Sent: Wednesday, May 15, 2019 12:48 AM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: python pyjnius mapping

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 HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190515/8aa66431/attachment.html>


More information about the x3d-public mailing list