[x3d-public] X3DPSAIL x3d.py package updated and deployed to x3d.py, adding initial support for JSON export
John Carlson
yottzumm at gmail.com
Sun Dec 5 22:19:40 PST 2021
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.
I sent a previous message about HelloWorld.py and how the fields might
be converted to lists in the the constructor call.
I will probably talk to you about how to make MF fields iterable in the
next few days and whether they need to be
I think that pretty much summarizes previous messages.
On 12/5/21 23:47, Brutzman, Donald (Don) (CIV) wrote:
>
> Am happy to report that after a bunch of work, X3DPSAIL x3d.py package
> is updated and deployed to x3d.py
>
> Python users can update using PyPy with the command “pip install x3d”
> – pretty simple!
>
> https://pypi.org/project/x3d
>
> Documentation:
>
> * Python X3D Package x3d.py, X3D Python Scene Access Interface
> Library (X3DPSAIL)
> * The x3d.py Python X3D Package supports programmers with Python
> interfaces and objects for standards-based X3D programming, all as
> open source.
> * https://www.web3d.org/x3d/stylesheets/python/python.html
>
> Improvements include:
>
> 1. VRML export improvements and JSON export added, though likely with
> a few bugs still.
> 2. added method XMLvalidate() for well-formed checkes and schema
> validation,
> 3. added utility function prepend_line_numbers() for prettier file
> outputs/excerpts when desired,
> 4. fixed hasChild() function,
> 5. confirmed fixed-value functions working as constants (no set methods),
> 6. added appropriate @classmethod and @staticmethod annotations for
> simpler invocation,
> 7. VRML and JSON export smoke tests,
> 8. Display selected REGEX_XML() values (available for all field
> types) and TOOLTIP_URL() values (available for all types, nodes
> and statements).
>
> Repeating and refining rapid-fire smoke tests and also immense
> regression tests for all X3D Example Archives.
>
> 1. Example usage in detail:
> https://www.web3d.org/x3d/stylesheets/python/examples/PythonX3dSmokeTests.py
> 2. Example usage results:
> https://www.web3d.org/x3d/stylesheets/python/build.examples.log.txt
> 3. Sample IDLE screenshot:
> https://www.web3d.org/x3d/stylesheets/python/images/PythonX3dSmokeTestsIDLE.png
>
> 4. X3D Resources, Examples: Scene Archives for X3D - model links and
> build log follows.
> 5. https://www.web3d.org/x3d/content/examples/X3dResources.html#Examples
> 6. https://www.web3d.org/x3d/content/examples/build.python.all.log.txt
> 7. Once again X3dToPython.xslt stylesheet applies latest greatest
> code patterns and includes a self-test block at the end,
> self-reporting either success or a problem.
>
> Vince, your reported apostrophe/quotation serialization issues look to
> be fixed according to the following test excerpts. How are these:
>
> * https://www.web3d.org/x3d/stylesheets/python/examples/HelloWorld.x3d
>
> <Scene>
>
> <!-- Example scene to illustrate X3D nodes and fields (XML
> elements and attributes) -->
>
> <WorldInfo title='Hello World!'/>
>
> <WorldInfo title='Hello ' apostrophe 1'/>
>
> <WorldInfo title="Hello ' apostrophe 2"/>
>
> <WorldInfo title='Hello " quotation mark 3'/>
>
> <WorldInfo title="Hello " quotation mark 4"/>
>
> <MetadataSet name="items'">
>
> <MetadataInteger containerField="value" name="one" value="1"/>
>
> <MetadataInteger containerField="value" name="two" value="2"/>
>
> </MetadataSet>
>
> <Group>
>
> * https://www.web3d.org/x3d/stylesheets/python/examples/HelloWorld.py
>
> Scene=Scene(
>
> # Example scene to illustrate X3D nodes and fields (XML elements
> and attributes)
>
> children=[
>
> WorldInfo(title='Hello World!'),
>
> WorldInfo(title="Hello ' apostrophe 1"),
>
> WorldInfo(title="Hello ' apostrophe 2"),
>
> WorldInfo(title='Hello " quotation mark 3'),
>
> WorldInfo(title='Hello " quotation mark 4'),
>
> MetadataSet(name="items'",
>
> value=[
>
> MetadataInteger(name='one',value=[1]),
>
> MetadataInteger(name='two',value=[2])]),
>
> Group(
>
> Lots and lots of code tuneups performed by paying attention to pylint
> warnings. Hopefully no unintended side effects for others, meanwhile
> the test cases all seem stable. This pylint quest originally started
> with over 100K lines of warning (urrk cough cough cough) and is now
> down to 700 lines... The great bug hunt continues.
>
> * https://www.web3d.org/x3d/stylesheets/python/build.pylint.log.txt
> * pylint reports: “Your code has been rated at 9.89/10 (previous
> run: 9.89/10, +0.00)”
>
> 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…
>
> New TODOs include figuring out how to apply regexes on each field
> during XML export for additional quality assurance.
>
> * https://www.web3d.org/specifications/X3dRegularExpressions.html
>
> Issue reports always welcome. Have fun with X3D Python! 8)
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211206/f030c17e/attachment-0001.html>
More information about the x3d-public
mailing list