[x3d-public] Request for X3D encoding comment output from X3DPSAIL
John Carlson
yottzumm at gmail.com
Mon Dec 29 08:53:02 PST 2025
Here’s how I currently handle multiline comments in python:
"""<OrientationInterpolator DEF='Stop_l_midtarsal_RotationInterpolator'
key='0 0.5 1' keyValue='0 0 1 0 0 0 1 0 0 0 1 0'/>"""
OrientationInterpolator1792 = x3d.OrientationInterpolator()
OrientationInterpolator1792.DEF = "Stop_l_metatarsal_RotationInterpolator"
OrientationInterpolator1792.key = [0,0.5,1]
Group1783.children.append(OrientationInterpolator1792)
(I realize keyValue is missing, my bad)
Here’s how I envision the comment:
Comment1791 = x3d.Comment("""<OrientationInterpolator
DEF='Stop_l_midtarsal_RotationInterpolator' key='0 0.5 1' keyValue='0 0 1 0
0 0 1 0 0 0 1 0'/>""")
Group1783.children.append(Comment1791)
Easy, I hope?
I’m going to pursue this in my PythonSerializer!
Next, GraalPy.
John
On Mon, Dec 29, 2025 at 5:40 AM John Carlson <yottzumm at gmail.com> wrote:
> Well, there already is an X3DStatement called Comment in X3DPSAIL.
>
> Can X3dToPython.xslt use it?
>
> John
>
> On Mon, Dec 29, 2025 at 5:25 AM John Carlson <yottzumm at gmail.com> wrote:
>
>> Including Loren. Loren, Don and I have been discussing how to handle
>> converting multi-line XML comments to Python in XSLT for X3DPSAIL programs.
>> Particularly using X3dToPython.xslt. I am not an expert at XSLT, and
>> don’t have appropriate tools, so I’ve been leaning on Don unduly.
>>
>> Note that I do like:
>>
>> “””
>> comment here
>> “””
>>
>> Python comments, but I don’t know if we can put them directly in the
>> scenegraph. Just putting one “#” for a multi-line XML comment when
>> translating to Python isn’t going to work. Maybe removing line endings
>> would work. Also a “#” per comment line may also work.
>>
>> I think the combination of a “””…””” multi-line comment and a
>> CommentsBlock class instance constructor wrapper around the comment may do
>> the trick, and also fits in the scene graph for round-tripping. This has
>> worked in X3DJSAIL, AFAIK. I don’t know about output from X3DPSAIL yet. I
>> believe that X3DJSAIL also offers .addComments() methods to add
>> CommentsBlock instances to the scenegraph, in many classes. I would
>> primarily like this feature in order to do round-trip testing back to XML.
>> Obviously there’s a whole discussion whether we should be converting XML to
>> Java and Python. That’s how I create Java and Python test cases. Don
>> prefers hand-coding tests, I think, and probably feels he is serving the
>> programming community. I feel we have 4000+ XML examples that serve an
>> excellent proving ground. Plus, I also have my own tests for my JSON
>> loader I create from XML.
>>
>> Ultimately the above will be critical if we wish to output comments using
>> the XML(), VRML() and JSON(), etc. methods in X3DPSAIL to produce
>> documentation inside the scenegraph output. This will be useful for
>> documenting X3D encoded files output from Maya, Blender, etc.
>>
>> Don hasn’t weighed in on this except to state he needs simple examples,
>> or examples in the archive that he controls. Previous bug reports have
>> been marked ‘won’t fix.’
>>
>> Joe and I created an .x3d file with multi-line comments that broke the
>> Python generated by X3dToPython.xslt.
>>
>> I can find a multi-line comments in the XML in the X3D archive, if there
>> are any there, the POSIX shell command is relatively simple. If you need
>> help identifying multi-line comments to reduce to single-line comments,
>> that should be a cinch! I can probably produce a list of files.
>>
>> Ultimately, the solution may just be to use single-line comments, but
>> that doesn’t allow round-tripping.
>>
>> John
>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20251229/f3b6336a/attachment.html>
More information about the x3d-public
mailing list