[x3d-public] X3DPSAIL x3d.py package updated and deployed to x3d.py, adding initial support for JSON export

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Mon Dec 6 08:35:34 PST 2021


See the code in x3d.py for details on use of Null and []

Testing that a list is not empty before iterating avoids errors like object is not iterable


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 https:// faculty.nps.edu/brutzman

From: John Carlson <yottzumm at gmail.com>
Sent: Sunday, December 5, 2021 10:41 PM
To: Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>; Vince Marchetti <vmarchetti at kshell.com>
Cc: X3D Public Mailing List (x3d-public at web3d.org) <x3d-public at web3d.org>
Subject: Re: X3DPSAIL x3d.py package updated and deployed to x3d.py, adding initial support for JSON export

NPS WARNING: *external sender* verify before acting.



On 12/6/21 00:29, John Carlson wrote:


On 12/6/21 00:19, John Carlson wrote:

Don, I will probably begin working on JSON export testing after I take the JSON import example for a short spin.  It's good to get a code download.

Note that SFVec3f should put a tuple in the structure when parsing JSON...normal JSON does not include tuples, so there needs to be a type conversion.

That is, centerOfRotation and position in Viewpoint should be tuples, not lists as JSON provides.
Fixed as far as I am concerned right now.  I will try to remove my tuple soon.
Tested removing tuple() without any problems.


I sent a previous message about HelloWorld.py and how the fields might be converted to lists in the the constructor call.
That has been done, AFAICT.

SFVec3f field values converted to lists from tuples, to clarify.  Good work!

John, please collect your comments and examples regarding JSON export flaws.  The build.examples.log.txt file is a good place to start.  Am returning to work this week, finishing up everything not yet done this year…

I need to talk to you about making MF fields and nodes iterable.  Output fails in both JSON and XML output.

See traceback here:



Traceback (most recent call last):
 File "/c/x3d-code/www.web3d.org/x3d/content/examples/x3dinput.py", line 141, in <module>
   print(scene.JSON())
 File "/c/x3d-code/www.web3d.org/x3d/content/examples/x3d.py", line 12790, in JSON
   result += str(self.head.JSON(indentLevel=indentLevel+1, syntax=syntax))
 File "/c/x3d-code/www.web3d.org/x3d/content/examples/x3d.py", line 10792, in JSON
   for each in self.children:
TypeError: 'JSON_MFNode' object is not iterable



I'm hoping we can spend some collaboration time working on these issues.  Otherwise, I will try to engage my python programmer to discuss options.

Pretty much all my code has been posted except for removing tuple().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211206/f467667f/attachment.html>


More information about the x3d-public mailing list