<div dir="auto">I am primarily concerned with A) at this point.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">I will look into the kwargs solution, I don’t recall looking at before.</div><div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Aug 25, 2025 at 5:24 PM Andreas Plesch <<a href="mailto:andreasplesch@gmail.com">andreasplesch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Personally, I do not have updates and would have to look up the discussion at the time.</div><div><br></div><div>I believe there were two sources of USE before DEF x3d code using x3d.py:</div><div><br></div><div>A) - x3d.py assembling result output in some fixed order, for example the Metadataset.metadata field is output before the MetadataSet.value field, regardless of parameter order.</div><div>B) - explicitly appending DEF nodes after USE nodes in python by user, perhaps by accident</div><div><br></div><div>I tried to first address A) by modifying x3d.py generation to process the field arrays in order (using the python **kwargs feature to get access to the parameter)  since array parameters are the default python x3d style. I think this works but leads to harder to understand code. (Run test/MetadataNodeExampleV4.py).</div><div><br></div><div>I then tried to address B) although it is mostly user error but realizing a solution should also address A). This is done through postprocessing the x3d.py generated python scene structure and just building up dictionaries of encountered DEF and USE nodes, and then swapping them as necessary. I could get it to work for the most common situations but it will need a lot more work. It should be doable and would be probably a preferred solution. (Run test/swap_USEbeforeDEF.py).</div><div><br></div><div>-Andreas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 25, 2025 at 3:34 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</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 dir="auto">Let me know of any updates, my brain is back 2+ years ago.  I’m working on a Python based renderer (no X3D encodings), and sometimes, I want to output XML and VRML from Python to check the scene, and potentially others will too.  I have 2 struggles, containerFields (another message) and DEF/USE ordering on output.</div><div dir="auto"><br></div><div dir="auto">Most likely, the best approach is to remove USE, and use variables instead in my python.   But yes, we also need logic in x3d.py output to add USE and possibly different containerFields appropriately.   Maybe using Andreas’s kwargs branch is best???  <div dir="auto"><div dir="auto"><a href="https://github.com/andreasplesch/x3d-python-mod/tree/kwargs" target="_blank">https://github.com/andreasplesch/x3d-python-mod/tree/kwargs</a></div><div dir="auto"><br></div><div dir="auto">Using variables is not common in X3dToPython.xslt output (yes, it uses parameters), but it’s extremely common in my PythonSerializer.js output, so I’m guessing that X3dToPython.xslt restructures the scenegraph output to conform to x3d.py output.  That seems extremely messy, but perhaps that’s the power of XSLT.<br></div><div dir="auto"><span><br></span></div><div dir="auto"><span>How do we propagate solutions in x3d-tidy and Castle to other systems?  I’m hearing that Castle is working on a Python solution?  Will it work with the x3d.py API?</span></div><div dir="auto"><span><br></span></div><div dir="auto"><span>Who else wants to write python that generates good VRML and XML?   Do we have to design our Python (or possibly source JSON and XML) according to how x3d.py outputs fields?  That would be okay, perhaps?</span><br></div><div dir="auto"><span><br></span></div><div dir="auto"><span>How dow we attach different containerFields to the same scenegraph node?</span></div><div dir="auto"><span><br></span></div><div dir="auto">John<br></div></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><span></span></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Andreas Plesch<br>Waltham, MA 02453</div></div></div>
</blockquote></div></div>