<div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12pt"><p style="margin: 0.1rem 0; line-height: 1.0;">As much as I have seen, I know the DOM is a tree, which could have a DAG embedded as x3d, but, even after a couple of tries, the DOM is a tree. What a difference a DAG makes. </p>
<p style="margin: 0.1rem 0; line-height: 1.0;"> </p>
<p style="margin: 0.1rem 0; line-height: 1.0;"><span style="font-family: Arial; font-size: 12pt;">-----Original Message-----</span></p>
</div>
<div class="elnk-inline-message-container" style="border-left: 1px solid #aaa; box-sizing: border-box; padding: 10px 0 10px 15px; margin: 0;">
<p>From: John Carlson <yottzumm@gmail.com><br>Sent: Aug 2, 2023 1:21 PM<br>To: Joe D Williams <joedwil@earthlink.net><br>Cc: GPU Group <gpugroup@gmail.com>, X3D Graphics public mailing list <x3d-public@web3d.org><br>Subject: Re: [x3d-public] x3d.py Re: Tree-to-tree transformation</p>
<p style="margin: 0.1rem 0; line-height: 1.0;"> </p>
<div dir="auto">Agreed! I’m referring to ASTs, Abstract Syntax Trees. Yes, duplicate children DEF/USE are merged, but not in typical DOM? I’m not sure.</div>
<div dir="auto"> </div>
<div dir="auto">Let me know.</div>
<div dir="auto"> </div>
<div dir="auto">John </div>
<div><br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Wed, Aug 2, 2023 at 2:57 PM Joe D Williams <<a href="mailto:joedwil@earthlink.net">joedwil@earthlink.net</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">
<div style="color: #000000; font-family: arial,sans-serif; font-size: 12pt;">
<p style="margin: 0.1rem 0; line-height: 1.0;">Hi All,</p>
<p style="margin: 0.1rem 0; line-height: 1.0;">It is not a tree, it is a DAG, <span style="color: #4d5156; font-family: 'Google Sans',Roboto,arial,sans-serif; font-size: 16px; white-space: normal; background-color: #ffffff; float: none; display: inline;">directed acyclic graph, which is much more fun than a tree. </span></p>
<p style="margin: 0.1rem 0; line-height: 1.0;"><span style="color: #4d5156; font-family: 'Google Sans',Roboto,arial,sans-serif; font-size: 16px; white-space: normal; background-color: #ffffff; float: none; display: inline;">Yes, the x3d HAnim structures and accessories can be a tree, but a DAG is so much more fun. </span></p>
<p style="margin: 0.1rem 0; line-height: 1.0;">A tree is so, not quite x3d. </p>
</div>
<div style="color: #000000; font-family: arial,sans-serif; font-size: 12pt;">
<p style="margin: 0.1rem 0; line-height: 1.0;">Joe</p>
<p style="margin: 0.1rem 0; line-height: 1.0;"> </p>
</div>
<div style="border-left: 1px solid #aaa; box-sizing: border-box; padding: 10px 0 10px 15px; margin: 0;">
<p>-----Original Message-----<br>From: John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank" rel="noopener">yottzumm@gmail.com</a>><br>Sent: Aug 2, 2023 12:51 PM<br>To: GPU Group <<a href="mailto:gpugroup@gmail.com" target="_blank" rel="noopener">gpugroup@gmail.com</a>>, X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank" rel="noopener">x3d-public@web3d.org</a>><br>Subject: Re: [x3d-public] x3d.py Re: Tree-to-tree transformation</p>
<p style="margin: 0.1rem 0; line-height: 1.0;"> </p>
<div>
<div dir="auto">The JSON parser/loader is part of Python, so if you use it, fewer problems will happen, as you say. There are VRML parsers/loaders in each VRML supporting browser. I think X_ITE/x3d-tidy has one. I’m just trying to get one loader working, and my current choice is python program synthesis. Ugh! I guess i could write something that instantiates x3d instances with eval. I’ve always heard that eval is a “bad thing,” but I’ve used it in a pinch.</div>
</div>
<div dir="auto"> </div>
<div dir="auto">John </div>
<div>
<div><br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Wed, Aug 2, 2023 at 2:28 PM GPU Group <<a href="mailto:gpugroup@gmail.com" target="_blank" rel="noopener">gpugroup@gmail.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">
<div dir="ltr">I haven't seen any import functions in x3d.py. The code isn't too hard to read. I think import is harder than export, because there are so many things that can be wrong with an import file, and it's not 1:1. But exporting --once you have a clean scenegraph-- is easy.
<div>I think the default brute force way to import is to load a file into its native tree -- html into an html tree, json into a json tree (like we load glTF), x3d into an xml tree. There are standard loaders for those. Is there a loader like that for vrml/classic/x3dv? </div>
<div>Then traverse that tree and convert to x3d.py nodes as you go. </div>
<div>-Doug</div>
<div>Here's another example code of a standalone program using x3d.py I was working on recently.</div>
<div><a href="https://freewrl.sourceforge.io/tests/43_MIDI/88key/OLD/keyboard_gen_x3dpy.py" target="_blank" rel="noopener">https://freewrl.sourceforge.io/tests/43_MIDI/88key/OLD/keyboard_gen_x3dpy.py</a> </div>
<div>- which shows a few more examples of the syntax x3d.py needs.</div>
<div>- program didn't work due to hard thing: a ProtoInstance with SFNode in an MFNode fieldvalue. Hypotheses: H0: I'm not using the right syntax for x3d.py in that case H1: x3d.py has a bug. </div>
<div>- But generally works pretty good once you figure out the syntax, class names, fields etc.</div>
<div> </div>
</div>
<br>
<div class="gmail_quote"> </div>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Wed, Aug 2, 2023 at 1:00 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank" rel="noopener">yottzumm@gmail.com</a>> wrote:</div>
</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">
<div dir="auto">I am thinking about X3d.py design.</div>
<div dir="auto"> </div>
<div dir="auto">I was not aware if x3d.py had any input, clarification?</div>
<div dir="auto"> </div>
<div dir="auto">I’m trying to read this:</div>
<div dir="auto"> </div>
<div dir="auto">
<div><a href="https://www.web3d.org/x3d/stylesheets/python/python.html" target="_blank" rel="noopener">https://www.web3d.org/x3d/stylesheets/python/python.html</a></div>
</div>
<div dir="auto"> </div>
<div dir="auto">It would seem appropriate to have a core X3D abstract python model, call it the python object model or POM, and then add what i call python “view,” “presentation,” or “encoding” models for XML, JSON, X3DOM, VRML, and X_ITE …input/output, perhaps generated by more than one stylesheet. I think stuffing the encodings into one package is not the right design. We should follow the standards way of separating abstract architecture from encoding and binding.</div>
<div dir="auto"> </div>
<div dir="auto">I would propose stylesheets for each encoding, just like we have for converting XML to various encodings, X3dTo….xslt.</div>
<div dir="auto"> </div>
<div dir="auto">What’s the counter argument?</div>
<div dir="auto"> </div>
<div dir="auto">I welcome any discussion, this is kind of the monolithic kernel versus microkernel idea i realize. Monolithic won.</div>
<div dir="auto"> </div>
<div dir="auto">This is also along the lines of HTMLElement, SVGElement, Node, and Element in ECMAScript.</div>
<div dir="auto"> </div>
<div dir="auto">You can still stuff it all in the same x3d.py file, one can also support XML(), VRML() methods on the abstract model that defer or delegate to encoding models. I don’t think anything breaks.</div>
<div dir="auto"> </div>
<div dir="auto">Is this somehow un-pythonic?</div>
<div dir="auto"> </div>
<div dir="auto">John </div>
<div><br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Wed, Aug 2, 2023 at 1:21 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank" rel="noopener">yottzumm@gmail.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">Does anyone know good tools for tree-to-tree transformation? I know ANTLR and XML/XSL/XSLT. I guess this is pretty much a compiler task. Are there tools for Classic VRML and JSON? Python/Perl/ECMAScrpt?
<div dir="auto"> </div>
<div dir="auto">John</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">_______________________________________________<br>x3d-public mailing list<br><a href="mailto:x3d-public@web3d.org" target="_blank" rel="noopener">x3d-public@web3d.org</a><br><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank" rel="noopener noreferrer">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></blockquote>
</div>
_______________________________________________<br>x3d-public mailing list<br><a href="mailto:x3d-public@web3d.org" target="_blank" rel="noopener">x3d-public@web3d.org</a><br><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank" rel="noopener noreferrer">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></blockquote>
</div>
</div>
</div>
</div>
<p style="margin: 0.1rem 0; line-height: 1.0;"> </p>
</blockquote>
</div>
</div>
</div>
<p style="margin: 0.1rem 0; line-height: 1.0;"> </p>