<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Applying Andreas' x3dcf.py <a href="https://github.com/andreasplesch/x3d-python-mod/blob/main/x3dcf.py">https://github.com/andreasplesch/x3d-python-mod/blob/main/x3dcf.py</a> to DiamondManLOA0.py,</div><div dir="ltr"><div><br></div><div>basically doing:</div><div><br></div><div>from x3dcf import *</div><div><br></div><div>instead of</div><div><br></div><div>from x3d import *</div><div><br></div><div>After editing output from DiamonManLOA0.py as well, see attachments.</div><div><br></div><div>Here is output from tovrmlx3d.exe</div><div><br></div><div><div>~/Downloads/view3dscene-4.3.0-win64-x86_64/view3dscene/tovrmlx3d.exe --validate DiamondManLOA0.x3d</div><div>tovrmlx3d: Warning: X3D: Incorrect USE clause: node name "hanim_humanoid_root" undefined (possibly the USE clause appears before the DEF for this node name)</div><div>tovrmlx3d: Warning: X3D: Incorrect USE clause: node name "hanim_sacroiliac" undefined (possibly the USE clause appears before the DEF for this node name)</div><div>tovrmlx3d: Warning: X3D: Incorrect USE clause: node name "hanim_pelvis" undefined (possibly the USE clause appears before the DEF for this node name)</div><div>tovrmlx3d: Warning: HAnimHumanoid.joints list was empty, fixed to list all 2 joints</div><div>Exception "Exception":</div><div>Validation failed (consult the warnings above), exiting with non-zero status</div></div><div><br></div><div>I'm guessing before looking at the file that USE is coming before DEF. Indeed a quick grep reveals USE before DEF:</div><div><br></div><div><div>$ grep hanim_humanoid_root DiamondManLOA0.x3d (output, not input)</div><div> <HAnimJoint containerField='joints' USE='hanim_humanoid_root'/></div><div> <HAnimJoint containerField='skeleton' DEF='hanim_humanoid_root' center='0.0 0.824 0.0277' name='humanoid_root'></div></div><div><br></div><div>But if you look at the original python, the USE and DEF are the other way around:</div><div><br></div><div><div>$ grep hanim_humanoid_root DiamondManLOA0.py</div><div> HAnimJoint(DEF='hanim_humanoid_root',center=(0.0,0.8240,0.0277),name='humanoid_root',ulimit=[0,0,0],llimit=[0,0,0],</div><div> HAnimJoint(USE='hanim_humanoid_root',ulimit=[0,0,0],llimit=[0,0,0]),</div></div><div><br></div><div>What's going on? <a href="http://x3d.py/x3dcf.py">x3d.py/x3dcf.py</a> is reordering the fields, against author intent. There are also extra fields, ulimit and llimit placed in the USE node in the by X3dToPython.xslt. See original x3d: <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.x3d">https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.x3d</a> compare to python generated: <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0Index.html">https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.py</a></div><div><br></div><div>Even if X3dToPython.xslt is fixed to not put extra fields in USE nodes, there will remain the question of DEF/USE ordering. I have patched this skeleton/joints in my <a href="http://nowhere" target="_blank" style="font-family:"Times New Roman";font-size:medium">X3duomToX3dPythonPackage.xslt</a> (not a link), and I am offering it. I will be able to provide a real link relatively soon.</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 1, 2023 at 3:06 AM 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="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">First off, I download:<div><br></div><div><a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.py" target="_blank">https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.py</a><br></div><div><br></div><div>It requires some edits. New version attached.</div><div><br></div><div>$ export PYTHONPATH=/c/Users/john/x3d-code/<a href="http://www.web3d.org/x3d/stylesheets/python/" target="_blank">www.web3d.org/x3d/stylesheets/python/</a><br></div><div><br></div><div>I had to edit the result XML, sorry, there's confusion between what goes to standard output (sys.stdout) and (sys.stderr). I had to add "import sys" to get stderr in the python program, and file=sys.stderr to print statements to separate output. That was not enough.</div><div><br></div><div>I had to delete "*** Python-to-XML well-formed XML document test failed.</div><div> x3dSchemaUrl=<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> XMLSchemaParseError cannot import namespace '<a href="http://www.w3.org/2000/09/xmldsig#" target="_blank">http://www.w3.org/2000/09/xmldsig#</a>': Entities are forbidden (entity_name='dsig')" from the result XML.</div><div><br></div><div>Result .x3d attached. Next we validate. tovrmx3d would not allow a comment at the beginning. Please start using sys.stderr in Python (hint, it's like System.err in Java). New version attached.</div><div><br></div><div><img src="cid:ii_lofgeu9b2" alt="image.png" width="412" height="249"><br></div><div><br></div><div><div>10 warnings:</div><div><br></div><div>X3D: X3D XML: More than one value specified for SFNode field MetadataSet.metadata</div><div>X3D: X3D XML: More than one value specified for SFNode field MetadataSet.metadata</div><div>X3D: X3D XML: More than one value specified for SFNode field MetadataSet.metadata</div><div>X3D: X3D XML: More than one value specified for SFNode field MetadataSet.metadata</div><div>X3D: X3D XML: More than one value specified for SFNode field MetadataSet.metadata</div><div>X3D: Incorrect USE clause: node name "hanim_humanoid_root" undefined (possibly the USE clause appears before the DEF for this node name)</div><div>X3D: Incorrect USE clause: node name "hanim_sacroiliac" undefined (possibly the USE clause appears before the DEF for this node name)</div><div>X3D: Incorrect USE clause: node name "hanim_pelvis" undefined (possibly the USE clause appears before the DEF for this node name)</div><div>X3D: Unknown X3D field name (indicated by containerField value) "children" by node "HAnimJoint" inside node "HAnimHumanoid"</div><div>X3D: Unknown X3D field name (indicated by containerField value) "children" by node "HAnimSite" inside node "HAnimHumanoid"</div><div><br></div><div>Scene URL: "DiamondManLOA0.x3d".</div><div>Use "File->View Warnings" menu to view these warnings again.</div></div><div><br></div><div>Sorry I cannot provide input to X3dToPython.xslt, as I don't know where the DiamondManLOA0.py came from, and I don't know a short way to use a stylesheet without tons of Java support, jars, etc. I want to focus on the python and the python output anyway. As far as I know, this is a pristine copy of x3d.py, but I provide it here:</div><div><br></div><div><a href="https://github.com/coderextreme/x3d-code/blob/main/www.web3d.org/x3d/stylesheets/python/x3d.py" target="_blank">https://github.com/coderextreme/x3d-code/blob/main/www.web3d.org/x3d/stylesheets/python/x3d.py</a><br></div><div><br></div><div>I already see 3 basic errors that should have been caught with a sandboxed environment. Next we will try X3d-Edit.</div><div><br></div><div>Oops, stack trace.</div><div><br></div><div><div>org.web3d.vrml.lang.UnsupportedComponentException</div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.vrml.renderer.DefaultNodeFactory.addComponent(DefaultNodeFactory.java:479)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.vrml.renderer.CRMainSceneBuilder.componentDecl(CRMainSceneBuilder.java:494)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.vrml.renderer.ogl.OGLVRMLSceneBuilder.componentDecl(OGLVRMLSceneBuilder.java:415)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.x3d.jaxp.X3DSAVAdapter.startElement(X3DSAVAdapter.java:973)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:752)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1387)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.parser.GeneralisedReader.parse(GeneralisedReader.java:236)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:130)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:163)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.vrml.scripting.browser.X3DCommonBrowser.createX3DFromStream(X3DCommonBrowser.java:182)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.vrml.scripting.external.sai.SAIBrowser.createX3DFromStream(SAIBrowser.java:831)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.x3d.xj3d.viewer.Xj3dViewerPanel.openXj3dScene(Xj3dViewerPanel.java:315)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.x3d.xj3d.viewer.Xj3dViewerPanel.openXj3dScene(Xj3dViewerPanel.java:294)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.web3d.x3d.X3DEditorSupport$X3dEditor.componentShowing(X3DEditorSupport.java:357)</span></div><div>[catch] at org.openide.windows.WindowManager.componentShowing(WindowManager.java:314)</div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.netbeans.core.windows.WindowManagerImpl.componentShowing(WindowManagerImpl.java:1236)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.netbeans.core.windows.WindowManagerImpl.specialPersistenceCompShow(WindowManagerImpl.java:1243)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.netbeans.core.windows.PersistenceHandler.load(PersistenceHandler.java:213)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.netbeans.core.windows.WindowSystemImpl.load(WindowSystemImpl.java:56)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.netbeans.core.GuiRunLevel$InitWinSys.run(GuiRunLevel.java:200)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)</span></div><div><span style="white-space:normal"><span style="white-space:pre-wrap"> </span>at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)</span></div></div><div><br></div><div><div>--------- X3D Validator checks commenced for DiamondManLOA0.x3d ---------</div><div><br></div><div>Performing well-formed XML check...</div><div>Checking file:/C:/Users/john/X3DJSONLD/blend/DiamondManLOA0.x3d...</div><div>Well-formed XML check: pass</div><div><br></div><div>Performing DOCTYPE check...</div><div>[X3dDoctypeChecker] success: valid XML declaration found.[X3dDoctypeChecker] success: final X3D 4.0 DOCTYPE found.</div><div><br></div><div>Performing DTD validation...</div><div>Checking file:/C:/Users/john/X3DJSONLD/blend/DiamondManLOA0.x3d...</div><div>Attribute "level" is required and must be specified for element type "component".</div><div>XML DTD validation: fail!</div><div><br></div><div>Performing X3D schema validation...</div><div>Checking file:/C:/Users/john/X3DJSONLD/blend/DiamondManLOA0.x3d...</div><div>Referenced entity at "<a href="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" target="_blank">http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd</a>".</div><div>Referenced entity at "<a href="http://www.w3.org/2001/XMLSchema.dtd" target="_blank">http://www.w3.org/2001/XMLSchema.dtd</a>".</div><div>Referenced entity at "<a href="http://www.w3.org/2001/datatypes.dtd" target="_blank">http://www.w3.org/2001/datatypes.dtd</a>".</div><div>Attribute "level" is required and must be specified for element type "component".</div><div>cvc-complex-type.4: Attribute 'level' must appear on element 'component'.</div><div>XML schema validation: fail!</div><div><br></div><div>Performing X3D regular expression (regex) values check...</div><div>X3D regex check: complete</div><div><br></div><div>Performing X3dToX3dvClassicVrmlEncoding.xslt conversion check...</div><div>Error checking type of the expression 'funcall(ends-with, [funcall(local-name, [step("parent", -1)]), literal-expr(Filter)])'.</div><div>Error checking type of the expression 'funcall(ends-with, [funcall(local-name, [step("parent", -1)]), literal-expr(Filter)])'.</div><div><br></div><div>Performing X3D Schematron check...</div></div><div><br></div><div>Enjoy fixing!</div><div><br></div></div></div></div></div></div></div></div></div>
</blockquote></div>