[x3d-public] Sample X3D Python API; examplespublishedforcontinuing improvement

John Carlson yottzumm at gmail.com
Mon Apr 22 23:22:23 PDT 2019


Working fine here.  Attached:

$ python HelloWorld.py
Warning: toFileX3D() is overwriting prior file /x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld_RoundTrip.x3d

$ diff -w HelloWorld_RoundTrip.x3d HelloWorld.x3d
22a23
>     <!-- Alternate encodings: VRML97, X3D ClassicVRML Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON -->
29a31
>     <!-- Example scene to illustrate X3D nodes and fields (XML elements and attributes) -->
33a36
>           <Sphere/>
38d40
<           <Sphere/>
42a45,47
>           <Text DEF='TextMessage' string='"Hello" "world!"'>
>             <FontStyle justify='"MIDDLE" "MIDDLE"'/>
>           </Text>
46,48d50
<           <Text DEF='TextMessage' string='"Hello" "world!"'>
<             <FontStyle family='"SERIF"' justify='"MIDDLE" "MIDDLE"'/>
<           </Text>

Please give me more insight into what you are seeing instead of what you are thinking, thanks.

Please show me where I am using abstract classes in a scenegraph python file.  Thanks a bunch.
Doing with Images is Symbols – Alan Kay.

Let’s work with ant scripts where you’re specifying a single XML file.

Don, all the python classes, whether they are from abstract Java classes are in separate files. So unless I am mistaken, they can’t get imported unless each file is explicitly loaded in a from … import … as.   Please verify that I am only loading files from jsail.

Note: I am no longer using autoclass for X3DForWebAuthors folder. I haven’t regenerated the other folders yet.  X3Dautoclass is *deprecated*.

Tell me what ant targets you want me to run from which specific folders, so I can duplicate your results.

I do not see how the concrete Java classes will work without the interfaces and abstract classes?   I am fairly sure they won’t compile.  How does that work?  Did we turn off the verifier or something?

Please tell me the next bug to work on.  Thanks!

More concreteness.  I will now delete the interfaces and the abstract classes from the org folder and rerun generation

John
Sent from Mail for Windows 10

From: Brutzman, Donald (Don) (CIV)
Sent: Tuesday, April 23, 2019 12:49 AM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] Sample X3D Python API;examplespublishedforcontinuing improvement

Thanks for look at all this John.  Here are some touchpoints.

- Do not use abstract classes.
- Do not provide references to abstract classes (X3D*Node, X3D*Object) in any of your mappings.
- Do not provide references to the .sai.* package, they too are all abstract interfaces with no concrete classes.

Next:
- quit worrying about autogeneration for a while.  That is what i was trying to say before.. just get the mapping right for HelloWorld.py
- once we have patterns that work for HelloWorld, and only then, do we worry about autogeneration of everything.
- steer far clear of prototypes and special edge cases until we have the basics working for HelloWorld.  They really don't matter in comparison, any solution to that is pointless if we can't do Shapes well.
- our goal is _not_ to choose between one .py or .future.py python style or another, rather get them both working compatibly just like we did in Java.

Further relaxations:
- we are not trying to re-implement all of X3DJSAIL, or all of the abstract interfaces provided in Java,
- we are simply trying to come up with a working syntax for X3D language binding to python, that is the goal.


On 4/22/2019 10:11 PM, John Carlson wrote:
> Do you plan on removing X3D*Node.class from the X3DJSAIL jar?  This is far too much work and is leading in the WRONG direction. If I don’t import the class in Python application, I’m not using it, as far as I know. I will try to mess with leaving out the from in the import for each class at some point, and just use import as if that sounds like a good plan.
> 
> Set you teeth on this problem, which I can’t solve, last I checked (found in pyjnius folder):
> 
> $ python abox.future.py
> 
> Traceback (most recent call last):
> 
>    File "abox.future.py", line 64, in <module>
> 
>      .setProtoField(SFString("myShape")) \
> 
>    File "jnius\jnius_export_class.pxi", line 760, in jnius.JavaMethod.__call__
> 
>    File "jnius\jnius_conversion.pxi", line 78, in jnius.populate_args
> 
>    File "jnius\jnius_utils.pxi", line 205, in jnius.check_assignable_from
> 
> jnius.JavaException: Invalid instance of 'org/web3d/x3d/jsail/X3DConcreteNode' passed for a 'org/web3d/x3d/sai/Core/X3DNode'
> 
> Make sure your up to date with the latest org version (does not use  X3Dautoclass.py).
> 
> John
> 
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *Brutzman, Donald (Don) (CIV) <mailto:brutzman at nps.edu>
> *Sent: *Monday, April 22, 2019 10:57 PM
> *To: *John Carlson <mailto:yottzumm at gmail.com>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *Re: [x3d-public] Sample X3D Python API; examplespublishedforcontinuing improvement
> 
> Our messages crossed but are quite similar... we might have the problem surrounded I hope...
> 
> On 4/22/2019 8:45 PM, John Carlson wrote:
> 
>  > This is a more broad problem than pyjnius, and is likely a Java problem that is letting things past the interface contract.  Okay, I will try to explain what the bug is:
> 
>  >
> 
>  > setDEF in X3DViewpointNode returns an X3DViewpointNode (interface)
> 
>  >
> 
>  > public X3DViewpointNode setDEF(String newValue);
> 
> [...]
> 
> Please make sure that you have _no_ references to abstract class X3DViewpointNode anywhere in your code.
> 
> The Java source for concrete class ViewpointObject specifically overrides its abstract parent superclass with an @Override annotation.  Inside X3DJSAIL the setDEF() method correctly returns type ViewpointObject.
> 
> If we remove all references to X3D*Node abstract classes everywhere and the problem still occurs, then
> 
> - perhaps not all of those definitions are removed, or
> 
> - perhaps an old file in the path is somehow visible, or
> 
> - we have isolated a bug in Pyjnius that we can ask them to fix.
> 
> Good luck sir.
> 
> 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
> 


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/20190423/8184d38e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HelloWorld.py
Type: application/octet-stream
Size: 6017 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190423/8184d38e/attachment-0001.obj>


More information about the x3d-public mailing list