[X3D-Ecosystem] Loading into X3DPSAIL (for Maya and Blender)

John Carlson yottzumm at gmail.com
Tue Jan 27 01:45:59 PST 2026


If I get a real urge, I will come up with a good example of a dynamic
import if someone else doesn't beat me to it!

Good luck!

John

On Tue, Jan 27, 2026 at 3:43 AM John Carlson <yottzumm at gmail.com> wrote:

> Frankly, the most reliable thing I can think of right now is converting
> XML to Python, then doing a dynamic import (is there such a thing?), eval
> of a string the python is read into, or ?  My vote is for dynamic import,
> if anyone wants to look it up. Here it is from Bing:
>
> import importlib
>
> module = importlib.import_module(model_file_basename) # load the X3D
> Python model as a module.
>
> Then just test for an attribute/function of the model module with "if
> hasattr(module, 'newModel'):" and do the right thing, like
> "module.newModel.XML()" etc.
>
> Not tested at all. Use responsibly.
>
> So we don't have an XML loader, but we do have a python loader!
>
> I'm wondering if Aaron took this approach?
>
> Not a security hole if your python or XML comes from trusted sources.
> Validate and schematron the XML for as much security as X3D can provide.
> Ultimately, the user has to verify, I think.
>
> John
>
> On Mon, Jan 26, 2026 at 6:01 PM Don Brutzman <don.brutzman at gmail.com>
> wrote:
>
>> Yes "X3DLoaderDOM.java (load DOM into scenegraph)" was difficult to
>> write, requires manual coding and time-consuming to debug.  It works and
>> the generator for it is checked into open source as a key part of X3DJSAIL.
>>
>>    -
>>    https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/X3DLoaderDOM.html
>>    - (on web3d.org but direct access is blocked, library not is version
>>    control since it is large and changeable; copy attached)
>>
>> The PythonX3dSmokeTests.py program builds a lot of snippets of python
>> scene graph.  The same approach might be used to walk any X3D tree and
>> construct a python scene graph.  If such code works, and is reliable, we
>> can promote that code and integrate it as part of the x3d.py distribution.
>>
>>    -
>>    https://www.web3d.org/x3d/stylesheets/python/examples/PythonX3dSmokeTests.py
>>
>> all the best, Don
>> --
>> X3D Graphics, Maritime Robotics, Distributed Simulation
>> Relative Motion Consulting  https://RelativeMotion.info
>>
>>
>> On Mon, Jan 26, 2026 at 2:54 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> Thanks for fixing the TODO to add XML!
>>>
>>> I have tried to add Python code which loads JSON into an X3DPSAIL scene
>>> graph and failed.  I have zero confidence in my ability to load stuff into
>>> in memory scene graphs, preferring to load things into DOM first.  This
>>> applies to much of my work, including JSON validation with X3D XML schema.
>>>
>>> I am attempting to load JSON into a CGE scene graph, but there’s no real
>>> evidence that it works yet.  I have a mostly working DOM solution.
>>>
>>> I realize X3DLoaderDOM.java (load DOM into scenegraph) is a lot of work,
>>> and if this was mostly automated, please tell us how if it’s not a
>>> national secret.  If we have that, then Python might be a lot easier!
>>>
>>> My overall plan is to push JSON things into DOM for loading, but Aaron
>>> might have a good solution for all encodings!
>>>
>>> I am reminded how Xj3D translated XML into a VRML scene graph.  Not
>>> ideal, but.
>>>
>>> My priorities are first CGE, then Blender import.  I realize my
>>> priorities change a lot.   If we had a way to export into Blender from
>>> X3DPSAIL, this would make working on X3DPSAIL import much more attractive.
>>> Easier said than done.
>>>
>>> John
>>>
>>> On Mon, Jan 26, 2026 at 3:51 PM Don Brutzman <don.brutzman at gmail.com>
>>> wrote:
>>>
>>>> Regarding C/C++/C# open source, no such library has yet been shared.
>>>> As with our autogenerated Java and Python libraries, these are strong
>>>> candidates for autogeneration once proper design patterns are written.
>>>> Once written, library testing using the X3D Example Archives would be
>>>> essential for success and straightforward to perform.
>>>>
>>>> Regarding X3D loaders in Python for X3DPSAIL, none has been written
>>>> yet.  Please be aware that .x3d files are written in valid XML.  Refreshed
>>>> TODO list:
>>>>
>>>>    - 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#TODO
>>>>
>>>> 🔖 <https://www.web3d.org/x3d/stylesheets/python/python.html#TODO> TODO
>>>> [image: to top]
>>>> <https://www.web3d.org/x3d/stylesheets/python/python.html#>
>>>>
>>>> Lots! Much progress continues. For a release-summary log, please see history
>>>> log for this page
>>>> <https://sourceforge.net/p/x3d/code/32962/log/?path=/www.web3d.org/x3d/stylesheets/python/python.html>
>>>> .
>>>>
>>>>
>>>>    - *TODO:* clean up x3d.html
>>>>       <https://www.web3d.org/x3d/stylesheets/python/x3d.html> documentation
>>>>       autogenerated by pydoc
>>>>       <https://docs.python.org/3/library/pydoc.html>.
>>>>       - *TODO:* We need a "Getting Started" tutorial on this page.
>>>>       This is a good opportunity... who wants to help?!
>>>>       - *TODO:* utility support for loaders from XML (.x3d or .xml),
>>>>       ClassicVRML (.x3dv), VRML97 (.wrl), and JSON (.json or .x3dj) files.
>>>>       - *TODO:* distribution support for Jupyter Notebook
>>>>       <https://jupyter.org/> (initial example works), Apache Zeppelin
>>>>       <https://zeppelin.apache.org/> notebook, Anaconda
>>>>       <https://www.anaconda.com/> distribution of Python, and other
>>>>       data-science platforms.
>>>>
>>>> To facilitate library review, I was recently able to autogenerate
>>>> Python documentation for x3d.py using the pydoc tool.
>>>>
>>>>    - https://www.web3d.org/x3d/stylesheets/python/x3d.html
>>>>
>>>> Please note that each X3D node has the following methods listed.
>>>>
>>>> Methods defined here:
>>>>> *HTML5*(self, indentLevel=0)
>>>>> Provide HTML5 output serialization using modified
>>>>> XML encoding with no singleton self-closing elements.
>>>>> *JSON*(self, indentLevel=0, syntax='JSON')
>>>>> Provide X3D
>>>>> <https://www.web3d.org/x3d/stylesheets/python/x3d.html#X3D>
>>>>>  output serialization using JSON encoding (usable for .json file suffix).
>>>>> *VRML*(self, indentLevel=0, VRML97=False)
>>>>> Provide X3D
>>>>> <https://www.web3d.org/x3d/stylesheets/python/x3d.html#X3D>
>>>>>  output serialization using VRML encoding (usable for .x3dv or .wrl file suffix).
>>>>> *XML*(self, indentLevel=0, syntax='XML')
>>>>> Provide Canonical X3D
>>>>> <https://www.web3d.org/x3d/stylesheets/python/x3d.html#X3D>
>>>>>  output serialization using XML encoding (usable for .x3d file suffix).
>>>>
>>>>
>>>> Am thinking the HTML5 method is no longer needed, this was written when
>>>> X3DOM had trouble with self-closing elements.
>>>>
>>>> Thanks for all efforts that might improve x3d.py.
>>>>
>>>> all the best, Don
>>>> --
>>>> X3D Graphics, Maritime Robotics, Distributed Simulation
>>>> Relative Motion Consulting  https://RelativeMotion.info
>>>>
>>>>
>>>> On Sun, Jan 25, 2026 at 4:18 AM John Carlson <yottzumm at gmail.com>
>>>> wrote:
>>>>
>>>>> I guess I didn't send this earlier.
>>>>>
>>>>> I did see the standards progress page.  For C/C++/C#, are any
>>>>> libraries open source?  I’m thinking COIN 3D, OpenInventor,  H3D.   Maybe
>>>>> others.  I see there’s an ISO documentation for each language, but
>>>>> apparently the standard isn’t open source????  I’m looking for
>>>>> opportunities for X3DJSONLD serialization. OpenInventor (COIN 3D) looks
>>>>> super complex.
>>>>>
>>>>> For X3DPSAIL, can you point me at an example of loading XML or DOM
>>>>> into a scenegraph? Maybe I missed something????  I’m looking for something
>>>>> like CreateX3DFromString()???   I realized I can create Python from XML,
>>>>> just like my tools can go from JSON to DOM to Python; but my toolchain
>>>>> isn’t Python.   Running stylesheets in Python would be a great example.
>>>>>
>>>>> Looking here:
>>>>>
>>>>>
>>>>> https://www.web3d.org/x3d/stylesheets/python/examples/PythonX3dSmokeTests.py
>>>>>
>>>>>
>>>>> On Sun, Jan 25, 2026 at 12:19 AM Don Brutzman <don.brutzman at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Standards planning status appears on the following page.
>>>>>>
>>>>>>    - X3D Standards Progress | Web3D Consortium
>>>>>>    <https://www.web3d.org/x3d/progress>
>>>>>>    - https://www.web3d.org/x3d/progress
>>>>>>
>>>>>> Scroll past overview prose to find links to each version completed,
>>>>>> in progress and planned.
>>>>>>
>>>>>> all the best, Don
>>>>>> --
>>>>>> X3D Graphics, Maritime Robotics, Distributed Simulation
>>>>>> Relative Motion Consulting  https://RelativeMotion.info
>>>>>>
>>>>>>
>>>>>> On Fri, Jan 23, 2026 at 7:44 PM John Carlson via X3D-Ecosystem <
>>>>>> x3d-ecosystem at web3d.org> wrote:
>>>>>>
>>>>>>> A quick search reveals this page:
>>>>>>>
>>>>>>> https://wiki.web3d.org/wiki/index.php/X3D_Python_Language_Binding
>>>>>>>
>>>>>>>
>>>>>>> This link on the page is dead?
>>>>>>>
>>>>>>> https://github.com/Web3DConsortium/X3D/tree/master/ISO-IEC%2019777
>>>>>>>
>>>>>>>
>>>>>>> Btw: both 19776-4 and 19776-5 are titled JSON encoding?????
>>>>>>> ==================================
>>>>>>>
>>>>>>> I could start writing a Python binding standard?  Except we have
>>>>>>> three versions, one based on GraalPy/X3DJSAIL and one based on “normal”
>>>>>>> python-X3DPSAIL, and if course H3D, which AFAIK, has C++ underneath?  I
>>>>>>> believe CGE may also have plans for Python.
>>>>>>>
>>>>>>> GraalPy examples are here:
>>>>>>>
>>>>>>>
>>>>>>> https://github.com/coderextreme/X3DJSONLD/tree/master/src/main/graalpy/net/coderextreme
>>>>>>>
>>>>>>> Python examples are on the X3D archives, some duplicated here:
>>>>>>>
>>>>>>>
>>>>>>> https://github.com/coderextreme/X3DJSONLD/tree/master/src/main/python/net/x3djsonld/data
>>>>>>>
>>>>>>> It seems like the pure python implementation (pythonic) has more
>>>>>>> sway and implementations, so I am willing to capitulate, even though, in my
>>>>>>> experience, X3DJSAIL generates better JSON!  It was never really my idea to
>>>>>>> go with a pure python version though, but I don’t know how to install
>>>>>>> GraalPy in Blender!  I will pay anyone $100 if they can make blender run
>>>>>>> GraalPy for import/export addons on Windows!  I’m guessing X3DPSAIL can run
>>>>>>> stylesheets as well?  Perhaps it’s time to convert stylesheets to pure
>>>>>>> Java, with a stylesheet of course!
>>>>>>>
>>>>>>> As far as support, GraalPy is supported by Oracle, and Python is
>>>>>>> supported by Microsoft (Does Guido still work there?).
>>>>>>>
>>>>>>> It would be very nice to have a renderer for X3DJSAIL and X3DPSAIL
>>>>>>> (see previous post)!
>>>>>>>
>>>>>>> Has anyone used Xj3D from GraalPy?
>>>>>>>
>>>>>>> ==================================
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Jan 23, 2026 at 8:52 PM John Carlson <yottzumm at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Apologies, I just noticed I meant X3D python binding.
>>>>>>>>
>>>>>>>> On Fri, Jan 23, 2026 at 8:50 PM John Carlson <yottzumm at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> What’s the status of the Python encoding standard?   Would my
>>>>>>>>> participation help?
>>>>>>>>>
>>>>>>>>> Instead of spending time on Blender currently, my thought is to go
>>>>>>>>> back to developing an “X3D” JSON to CGE scenegraph converter, as that can
>>>>>>>>> be developed beyond DOM loading.   Does anyone know a good Pascal LLM?   I
>>>>>>>>> do find begin/end rather tedious.
>>>>>>>>>
>>>>>>>>> If there’s a lot of demand for a Blender HAnim export currently, I
>>>>>>>>> will reconsider.   Or X3D to glTF conversion.
>>>>>>>>>
>>>>>>>>> John
>>>>>>>>>
>>>>>>>> --
>>>>>>> X3D-Ecosystem mailing list
>>>>>>> X3D-Ecosystem at web3d.org
>>>>>>> http://web3d.org/mailman/listinfo/x3d-ecosystem_web3d.org
>>>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20260127/4e8e22dc/attachment-0001.html>


More information about the X3D-Ecosystem mailing list