<div dir="ltr"><div dir="ltr">Sure, no need to read the python source code. Just look at the XML output, that's what we're complaining about. I can export VRML, just a second. Think of imperative source code like reading a recipe and combining things. You have to follow the order of things.<div><br></div><div><br></div><div><div><br></div><div><br></div><div>Here's another try:</div><div><br></div><div>from x3d import *</div><div><br></div><div>x3d = X3D()</div><div>trans = Transform(DEF='C')</div><div>grpa = Group(DEF='A', children=[trans])</div><div>trans.USE = 'C'</div><div>trans.DEF = 'WTF'</div><div>grpb = Group(DEF='B', children=[trans])</div><div>scene = Scene(children=[grpa, grpb])</div><div>x3d.Scene = scene</div><div>blob = x3d.XML()</div><div>print(blob)</div><div><br></div><div>Output:</div><div><br></div><div><div>x3d.py package 4.0.64.4 loaded, have fun with X3D Graphics!</div><div><?xml version="1.0" encoding="UTF-8"?></div><div><!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "<a href="https://www.web3d.org/specifications/x3d-4.0.dtd" target="_blank">https://www.web3d.org/specifications/x3d-4.0.dtd</a>"></div><div><X3D profile='Full' version='4.0' xmlns:xsd='<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>' xsd:noNamespaceSchemaLocation='<a href="https://www.web3d.org/specifications/x3d-4.0.xsd" target="_blank">https://www.web3d.org/specifications/x3d-4.0.xsd</a>'></div><div> <Scene></div><div> <Group DEF='A'></div><div> <Transform DEF='WTF'/></div><div> </Group></div><div> <Group DEF='B'></div><div> <Transform DEF='WTF'/></div><div> </Group></div><div> </Scene></div><div></X3D></div></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 16, 2023 at 10:29 PM Joe D Williams <<a href="mailto:joedwil@earthlink.net">joedwil@earthlink.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12pt"><p style="margin:0.1rem 0px;line-height:1">Sorry, I have no interest in trying to read and understand that listing. Regular user code is hard enough for me.</p>
<p style="margin:0.1rem 0px;line-height:1">What are you trying to do,anyway? Is the intent to generate x3d user code? </p>
<p style="margin:0.1rem 0px;line-height:1">Joe</p>
</div>
<div style="border-left:1px solid rgb(170,170,170);box-sizing:border-box;padding:10px 0px 10px 15px;margin:0px">
<p>-----Original Message-----<br>From: John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>><br>Sent: Oct 16, 2023 8:21 PM<br>To: Joe D Williams <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</a>><br>Cc: Brutzman Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>, GPU Group <<a href="mailto:gpugroup@gmail.com" target="_blank">gpugroup@gmail.com</a>>, Peitso Loren (CIV) <<a href="mailto:lepeitso@nps.edu" target="_blank">lepeitso@nps.edu</a>>, X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>Subject: Re: Thoughts for x3d.py str() calls</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Okay, to be more "SAI"-like, and not use append, I present the following python, which admittedly, is more complicated than Doug's initial example.
<div> </div>
<div> </div>
<div>
<div>from x3d import *</div>
<div> </div>
<div>x3d = X3D()</div>
<div>trans = Transform(DEF='C')</div>
<div>grpa = Group(DEF='A', children=[trans])</div>
<div>trans.DEF = None</div>
<div>trans.USE = 'C'</div>
<div>grpb = Group(DEF='B', children=[trans])</div>
<div>scene = Scene(children=[grpa, grpb])</div>
<div>x3d.Scene = scene</div>
<div>blob = x3d.XML()</div>
<div>print(blob)</div>
</div>
<div> </div>
<div> </div>
<div> </div>
<div>Output:</div>
<div> </div>
<div>
<div>x3d.py package 4.0.64.4 loaded, have fun with X3D Graphics!</div>
<div><?xml version="1.0" encoding="UTF-8"?></div>
<div><!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "<a href="https://www.web3d.org/specifications/x3d-4.0.dtd" target="_blank">https://www.web3d.org/specifications/x3d-4.0.dtd</a>"></div>
<div><X3D profile='Full' version='4.0' xmlns:xsd='<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>' xsd:noNamespaceSchemaLocation='<a href="https://www.web3d.org/specifications/x3d-4.0.xsd" target="_blank">https://www.web3d.org/specifications/x3d-4.0.xsd</a>'></div>
<div> <Scene></div>
<div> <Group DEF='A'></div>
<div> <Transform USE='C'/></div>
<div> </Group></div>
<div> <Group DEF='B'></div>
<div> <Transform USE='C'/></div>
<div> </Group></div>
<div> </Scene></div>
<div></X3D></div>
</div>
<div> </div>
<div>
<div>If you suggest that I change trans.DEF to something beside None, we can try that. I'll do that in my next message.</div>
<div> </div>
<div>Remember that the goal is to to produce fields which are order independent as output from x3d.py</div>
<div> </div>
<div>John</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Mon, Oct 16, 2023 at 10:00 PM Joe D Williams <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12pt">
<p style="margin:0.1rem 0px;line-height:1">Joeminion asks: So what is this other people's change thing.</p>
<p style="margin:0.1rem 0px;line-height:1">Is there somebody who knows the spec and wants to change something?</p>
<p style="margin:0.1rem 0px;line-height:1">What is to change? </p>
<p style="margin:0.1rem 0px;line-height:1">All any contributor has to do is show a better way. </p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">> <span style="font-size:12pt">Part of open source is accepting and incorporating other people’s changes.</span></p>
</div>
Please think about how to improve x3d. The open part means you can read the stuff, build tools around and in the stuff, experiment with it, and maybe contribute. Hey, all it takes is a good idea that improves the package.
<p style="margin:0.1rem 0px;line-height:1">Joe </p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<div style="border-left:1px solid rgb(170,170,170);box-sizing:border-box;padding:10px 0px 10px 15px;margin:0px">
<p>-----Original Message-----<br>From: John Carlson <<a href="mailto:yottzumm@gmail.com" rel="noopener" target="_blank">yottzumm@gmail.com</a>><br>Sent: Oct 16, 2023 7:13 PM<br>To: Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a>><br>Cc: GPU Group <<a href="mailto:gpugroup@gmail.com" rel="noopener" target="_blank">gpugroup@gmail.com</a>>, Joe D Williams <<a href="mailto:joedwil@earthlink.net" rel="noopener" target="_blank">joedwil@earthlink.net</a>>, Peitso, Loren (CIV) <<a href="mailto:lepeitso@nps.edu" rel="noopener" target="_blank">lepeitso@nps.edu</a>>, X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank">x3d-public@web3d.org</a>><br>Subject: Re: Thoughts for x3d.py str() calls</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<div dir="auto">Part of open source is accepting and incorporating other people’s changes. If you don’t do that, you’re not doing open source.</div>
<div dir="auto"> </div>
<div dir="auto">John </div>
<div><br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Mon, Oct 16, 2023 at 8:28 PM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div>
<p class="MsoNormal">Back to you guys… please use your friendly neighborhood python implementation to answer all these questions relating to code correctness and effectiveness.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<ul style="margin-top:0in" type="disc">
<li style="margin-left:0in">Wikipedia: Small matter of programming<u></u><u></u></li>
<li style="margin-left:0in"><a href="https://en.wikipedia.org/wiki/Small_matter_of_programming" rel="noopener" target="_blank">https://en.wikipedia.org/wiki/Small_matter_of_programming</a><u></u><u></u></li>
</ul>
</div>
</div>
<div lang="EN-US">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">all the best, Don<u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">-- <u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Don Brutzman Naval Postgraduate School, Code USW/Br <a style="font-family:"Courier New"" href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a><u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149<u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics <a style="font-family:"Courier New"" href="https://faculty.nps.edu/brutzman" rel="noopener" target="_blank">https://faculty.nps.edu/brutzman</a><u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div style="border-width:1pt medium medium;border-style:solid none none;padding:3pt 0in 0in;border-color:rgb(225,225,225) currentcolor currentcolor">
<p class="MsoNormal"><strong>From:</strong> John Carlson <<a href="mailto:yottzumm@gmail.com" rel="noopener" target="_blank">yottzumm@gmail.com</a>> <br><strong>Sent:</strong> Monday, October 16, 2023 6:13 PM<br><strong>To:</strong> Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a>><br><strong>Cc:</strong> GPU Group <<a href="mailto:gpugroup@gmail.com" rel="noopener" target="_blank">gpugroup@gmail.com</a>>; Joe D Williams <<a href="mailto:joedwil@earthlink.net" rel="noopener" target="_blank">joedwil@earthlink.net</a>>; Peitso, Loren (CIV) <<a href="mailto:lepeitso@nps.edu" rel="noopener" target="_blank">lepeitso@nps.edu</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank">x3d-public@web3d.org</a>><br><strong>Subject:</strong> Re: Thoughts for x3d.py str() calls<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">Don, there is no error in Doug’s python example. We’re back to the multiple parent problem previously discussed.<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">It is possible to set a flag in nodes that have been output and clear it afterwards. It’s also possible to keep a map of DEFed outputted nodes and put in USE if the node has multiple parents discard the map afterwards. The latter may be preferred.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Consider the case of a script handling several outputs from the same model.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">John<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Oct 16, 2023 at 3:47 PM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<div>
<div>
<p class="MsoNormal">The x3d.py makes no effort to correct author errors. That is up to the author. Trying to “fix” things further can lead to further problems and a corrupted model.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">There are a great many models in X3D Examples with DEF and USE which run properly in unit tests.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">There are several diagnostics built in for reporting errors. Have you tested your erroneous scene to see what you get? If a further error diagnostic is needed, we can add it to the X3DPSAIL TODO list. If you write a python method to do that, we can test it further and possibly integrate it.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<ul type="disc">
<li class="MsoNormal">X3D Python Scene Access Interface Library (X3DPSAIL), TODO<u></u><u></u></li>
<li class="MsoNormal"><a href="https://www.web3d.org/x3d/stylesheets/python/python.html#TODO" rel="noopener" target="_blank">https://www.web3d.org/x3d/stylesheets/python/python.html#TODO</a><u></u><u></u></li>
</ul>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">If a correct model is getting exported into another form incorrectly, then we can diagnose and fix the conversion. As ever, use-case examples of such errors are essential to continuing progress.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks for all efforts with X3D Python.<u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">all the best, Don</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">-- </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Don Brutzman Naval Postgraduate School, Code USW/Br <a style="font-family:"Courier New"" href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a></span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics <a style="font-family:"Courier New"" href="https://faculty.nps.edu/brutzman" rel="noopener" target="_blank">https://faculty.nps.edu/brutzman</a></span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div style="border-width:1pt medium medium;border-style:solid none none;padding:3pt 0in 0in;border-color:currentcolor">
<p class="MsoNormal"><strong>From:</strong> GPU Group <<a href="mailto:gpugroup@gmail.com" rel="noopener" target="_blank">gpugroup@gmail.com</a>> <br><strong>Sent:</strong> Monday, October 16, 2023 9:49 AM<br><strong>To:</strong> John Carlson <<a href="mailto:yottzumm@gmail.com" rel="noopener" target="_blank">yottzumm@gmail.com</a>><br><strong>Cc:</strong> Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" rel="noopener" target="_blank">brutzman@nps.edu</a>>; Joe D Williams <<a href="mailto:joedwil@earthlink.net" rel="noopener" target="_blank">joedwil@earthlink.net</a>>; Peitso, Loren (CIV) <<a href="mailto:lepeitso@nps.edu" rel="noopener" target="_blank">lepeitso@nps.edu</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank">x3d-public@web3d.org</a>><br><strong>Subject:</strong> Re: Thoughts for x3d.py str() calls<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">correction first output is <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <Scene><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Group DEF='A'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Transform DEF='C'/><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Group><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Group DEF='B'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Transform DEF='C'/><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Group><u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Oct 16, 2023 at 10:32 AM GPU Group <<a href="mailto:gpugroup@gmail.com" rel="noopener" target="_blank">gpugroup@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">That may relate to the DEF USE issue with X3D.py: <u></u><u></u></p>
<div>
<p class="MsoNormal">x x3d.py makes no effort to conjugate DEF and USE and properly order DEF before USE in its export stream<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">- not a common problem unless a node has 2 fields that take the same node (directly SF or indirectly in MFNode descendent field)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">x it's a problem with HAnimHumanoid which has coordinate and skin fields, which typically involve the same Coordinate node<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">- tinkering can be done in the blender exporter, to do a USE before a DEF, but with inconvenience and messy code<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">If a call can be made in x3d.py before exporting a DEF or USE, then that function can be over-ridden to take responsibility for DEF USE conjugation and correct output ordering something like this:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">node = getDefOrUse(node, node.DEF, node.USE)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">and for the x3d.py default it would just return the same element (or node), and overrides can do something more sophisticated.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">more..<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">DEF USE NON-CONJUGATION IN X3D.PY<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test_def.py<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">x3d = X3D()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">scene = Scene()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">x3d.Scene = scene<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpa = Group(DEF='A')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpb = Group(DEF='B')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">scene.children.append(grpa)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">scene.children.append(grpb)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">trans = Transform(DEF='C')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpb.children.append(trans)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpa.children.append(trans)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">blob = x3d.XML()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">fp = open("dump.x3d","w+")<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">fp.write(blob)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">fp.close()<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">output:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><?xml version="1.0" encoding="UTF-8"?><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "<a href="https://www.web3d.org/specifications/x3d-4.0.dtd" rel="noopener" target="_blank">https://www.web3d.org/specifications/x3d-4.0.dtd</a>"><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><X3D profile='Full' version='4.0' xmlns:xsd='<a href="https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=05%7C01%7Cbrutzman%40nps.edu%7C4181f75f38a24696882b08dbceae41c5%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638331020060039666%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MhoqazQK%2FlPhDhc%2BNJs6uMa7kFTpfKnJ1oGWwgxtakQ%3D&reserved=0" rel="noopener" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>' xsd:noNamespaceSchemaLocation='<a href="https://www.web3d.org/specifications/x3d-4.0.xsd" rel="noopener" target="_blank">https://www.web3d.org/specifications/x3d-4.0.xsd</a>'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Scene><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Group DEF='A'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Transform USE='C'/><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Group><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Group DEF='B'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Transform DEF='C'/><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Group><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Scene><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"></X3D><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">test_def_use.py<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">from x3d import *<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">x3d = X3D()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">scene = Scene()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">x3d.Scene = scene<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpa = Group(DEF='A')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpb = Group(DEF='B')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">scene.children.append(grpa)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">scene.children.append(grpb)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">trans = Transform(DEF='C')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpb.children.append(trans)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grpa.children.append(trans)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">blob = x3d.XML()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">fp = open("dump.x3d","w+")<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">fp.write(blob)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">fp.close()<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">output:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><?xml version="1.0" encoding="UTF-8"?><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "<a href="https://www.web3d.org/specifications/x3d-4.0.dtd" rel="noopener" target="_blank">https://www.web3d.org/specifications/x3d-4.0.dtd</a>"><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><X3D profile='Full' version='4.0' xmlns:xsd='<a href="https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=05%7C01%7Cbrutzman%40nps.edu%7C4181f75f38a24696882b08dbceae41c5%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638331020060039666%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MhoqazQK%2FlPhDhc%2BNJs6uMa7kFTpfKnJ1oGWwgxtakQ%3D&reserved=0" rel="noopener" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>' xsd:noNamespaceSchemaLocation='<a href="https://www.web3d.org/specifications/x3d-4.0.xsd" rel="noopener" target="_blank">https://www.web3d.org/specifications/x3d-4.0.xsd</a>'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Scene><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Group DEF='A'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Transform USE='C'/><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Group><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Group DEF='B'><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <Transform DEF='C'/><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Group><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> </Scene><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"></X3D><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Oct 16, 2023 at 10:09 AM GPU Group <<a href="mailto:gpugroup@gmail.com" rel="noopener" target="_blank">gpugroup@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<div>
<div>
<p class="MsoNormal">It seems possible to override functions in python, if there are just a few to override. <u></u><u></u></p>
<div>
<p class="MsoNormal">And one suggestion for x3d.py imperfections is to apply fixes at runtime in some initialization function.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">- that assumes/requires just a few target functions, not 480 functions that need to be repaired<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">- so for some fixes it may be helpful to change the upstream x3d.py to call a function that can be easily replaced.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">-Doug<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Example:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">file myclass.py <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">class Wonky:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> def __init__(self):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> self.color = "Red"<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> def func1(self, color :str) -> bool:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> if color == self.color:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return True<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return False<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">file override.py<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">from myclass import *<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">mc = Wonky()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">print("match with Blue? "+str(mc.func1("Blue")))<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">def func2(self, color: str) -> bool:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> if self.color != color:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return True<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return False<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Wonky.func1 = func2 # <<<<<<<<<<<< OVERRIDE<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">print("don't match with Blue? "+str(mc.func1("Blue")))<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">output:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">match with Blue? False<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">don't match with Blue? True<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal">-Doug<u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Oct 16, 2023 at 9:55 AM John Carlson <<a href="mailto:yottzumm@gmail.com" rel="noopener" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<p class="MsoNormal">Instead of calling str() to print out a value, call a function that does precision floating point formatting on floats according to a user’s wishes. If the value is a list, call the function recursively with a list comprehension, otherwise, call str. <u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I think this is doable by mere humans.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">John<u></u><u></u></p>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p style="margin:0.1rem 0px;line-height:1"> </p>
</blockquote>
</div>
</div>
<p style="margin:0.1rem 0px;line-height:1"> </p></blockquote></div>