[x3d-public] Diamond Main 0, first looks:
John Carlson
yottzumm at gmail.com
Sat Nov 4 16:18:01 PDT 2023
Don, please follow this thread carefully. There are many things flying
around, but primarily, we want X3dToPython.xslt produced python programs
using x3d.py to be able to output XML that is immediately validatable and
viewable.
That’s a good goal, right?
Thanks,
John
On Wed, Nov 1, 2023 at 12:26 PM John Carlson <yottzumm at gmail.com> wrote:
> Applying Andreas' x3dcf.py
> https://github.com/andreasplesch/x3d-python-mod/blob/main/x3dcf.py to
> DiamondManLOA0.py,
>
> basically doing:
>
> from x3dcf import *
>
> instead of
>
> from x3d import *
>
> After editing output from DiamonManLOA0.py as well, see attachments.
>
> Here is output from tovrmlx3d.exe
>
> ~/Downloads/view3dscene-4.3.0-win64-x86_64/view3dscene/tovrmlx3d.exe
> --validate DiamondManLOA0.x3d
> tovrmlx3d: Warning: X3D: Incorrect USE clause: node name
> "hanim_humanoid_root" undefined (possibly the USE clause appears before the
> DEF for this node name)
> tovrmlx3d: Warning: X3D: Incorrect USE clause: node name
> "hanim_sacroiliac" undefined (possibly the USE clause appears before the
> DEF for this node name)
> tovrmlx3d: Warning: X3D: Incorrect USE clause: node name "hanim_pelvis"
> undefined (possibly the USE clause appears before the DEF for this node
> name)
> tovrmlx3d: Warning: HAnimHumanoid.joints list was empty, fixed to list all
> 2 joints
> Exception "Exception":
> Validation failed (consult the warnings above), exiting with non-zero
> status
>
> I'm guessing before looking at the file that USE is coming before DEF.
> Indeed a quick grep reveals USE before DEF:
>
> $ grep hanim_humanoid_root DiamondManLOA0.x3d (output, not input)
> <HAnimJoint containerField='joints' USE='hanim_humanoid_root'/>
> <HAnimJoint containerField='skeleton' DEF='hanim_humanoid_root'
> center='0.0 0.824 0.0277' name='humanoid_root'>
>
> But if you look at the original python, the USE and DEF are the other way
> around:
>
> $ grep hanim_humanoid_root DiamondManLOA0.py
>
> HAnimJoint(DEF='hanim_humanoid_root',center=(0.0,0.8240,0.0277),name='humanoid_root',ulimit=[0,0,0],llimit=[0,0,0],
> HAnimJoint(USE='hanim_humanoid_root',ulimit=[0,0,0],llimit=[0,0,0]),
>
> What's going on? x3d.py/x3dcf.py 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:
> https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.x3d
> compare to python generated:
> https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.py
> <https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0Index.html>
>
> 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 X3duomToX3dPythonPackage.xslt <http://nowhere> (not
> a link), and I am offering it. I will be able to provide a real link
> relatively soon.
>
>
> On Wed, Nov 1, 2023 at 3:06 AM John Carlson <yottzumm at gmail.com> wrote:
>
>> First off, I download:
>>
>>
>> https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/DiamondManLOA0.py
>>
>> It requires some edits. New version attached.
>>
>> $ export PYTHONPATH=/c/Users/john/x3d-code/
>> www.web3d.org/x3d/stylesheets/python/
>>
>> 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.
>>
>> I had to delete "*** Python-to-XML well-formed XML document test failed.
>> x3dSchemaUrl=https://www.web3d.org/specifications/x3d-4.0.xsd
>> XMLSchemaParseError cannot import namespace '
>> http://www.w3.org/2000/09/xmldsig#': Entities are forbidden
>> (entity_name='dsig')" from the result XML.
>>
>> 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.
>>
>> [image: image.png]
>>
>> 10 warnings:
>>
>> X3D: X3D XML: More than one value specified for SFNode field
>> MetadataSet.metadata
>> X3D: X3D XML: More than one value specified for SFNode field
>> MetadataSet.metadata
>> X3D: X3D XML: More than one value specified for SFNode field
>> MetadataSet.metadata
>> X3D: X3D XML: More than one value specified for SFNode field
>> MetadataSet.metadata
>> X3D: X3D XML: More than one value specified for SFNode field
>> MetadataSet.metadata
>> X3D: Incorrect USE clause: node name "hanim_humanoid_root" undefined
>> (possibly the USE clause appears before the DEF for this node name)
>> X3D: Incorrect USE clause: node name "hanim_sacroiliac" undefined
>> (possibly the USE clause appears before the DEF for this node name)
>> X3D: Incorrect USE clause: node name "hanim_pelvis" undefined (possibly
>> the USE clause appears before the DEF for this node name)
>> X3D: Unknown X3D field name (indicated by containerField value)
>> "children" by node "HAnimJoint" inside node "HAnimHumanoid"
>> X3D: Unknown X3D field name (indicated by containerField value)
>> "children" by node "HAnimSite" inside node "HAnimHumanoid"
>>
>> Scene URL: "DiamondManLOA0.x3d".
>> Use "File->View Warnings" menu to view these warnings again.
>>
>> 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:
>>
>>
>> https://github.com/coderextreme/x3d-code/blob/main/www.web3d.org/x3d/stylesheets/python/x3d.py
>>
>> I already see 3 basic errors that should have been caught with a
>> sandboxed environment. Next we will try X3d-Edit.
>>
>> Oops, stack trace.
>>
>> org.web3d.vrml.lang.UnsupportedComponentException
>> at
>> org.web3d.vrml.renderer.DefaultNodeFactory.addComponent(DefaultNodeFactory.java:479)
>> at
>> org.web3d.vrml.renderer.CRMainSceneBuilder.componentDecl(CRMainSceneBuilder.java:494)
>> at
>> org.web3d.vrml.renderer.ogl.OGLVRMLSceneBuilder.componentDecl(OGLVRMLSceneBuilder.java:415)
>> at org.web3d.x3d.jaxp.X3DSAVAdapter.startElement(X3DSAVAdapter.java:973)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:752)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1387)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
>> at
>> java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
>> at org.web3d.parser.GeneralisedReader.parse(GeneralisedReader.java:236)
>> at
>> org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:130)
>> at
>> org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:163)
>> at
>> org.web3d.vrml.scripting.browser.X3DCommonBrowser.createX3DFromStream(X3DCommonBrowser.java:182)
>> at
>> org.web3d.vrml.scripting.external.sai.SAIBrowser.createX3DFromStream(SAIBrowser.java:831)
>> at
>> org.web3d.x3d.xj3d.viewer.Xj3dViewerPanel.openXj3dScene(Xj3dViewerPanel.java:315)
>> at
>> org.web3d.x3d.xj3d.viewer.Xj3dViewerPanel.openXj3dScene(Xj3dViewerPanel.java:294)
>> at
>> org.web3d.x3d.X3DEditorSupport$X3dEditor.componentShowing(X3DEditorSupport.java:357)
>> [catch] at
>> org.openide.windows.WindowManager.componentShowing(WindowManager.java:314)
>> at
>> org.netbeans.core.windows.WindowManagerImpl.componentShowing(WindowManagerImpl.java:1236)
>> at
>> org.netbeans.core.windows.WindowManagerImpl.specialPersistenceCompShow(WindowManagerImpl.java:1243)
>> at
>> org.netbeans.core.windows.PersistenceHandler.load(PersistenceHandler.java:213)
>> at
>> org.netbeans.core.windows.WindowSystemImpl.load(WindowSystemImpl.java:56)
>> at org.netbeans.core.GuiRunLevel$InitWinSys.run(GuiRunLevel.java:200)
>> at
>> java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
>> at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
>> at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
>> at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
>> at
>> java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
>> at
>> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
>> at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
>> at
>> org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
>> at
>> java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
>> at
>> java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
>> at
>> java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
>> at
>> java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
>> at
>> java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
>> at
>> java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
>>
>> --------- X3D Validator checks commenced for DiamondManLOA0.x3d ---------
>>
>> Performing well-formed XML check...
>> Checking file:/C:/Users/john/X3DJSONLD/blend/DiamondManLOA0.x3d...
>> Well-formed XML check: pass
>>
>> Performing DOCTYPE check...
>> [X3dDoctypeChecker] success: valid XML declaration
>> found.[X3dDoctypeChecker] success: final X3D 4.0 DOCTYPE found.
>>
>> Performing DTD validation...
>> Checking file:/C:/Users/john/X3DJSONLD/blend/DiamondManLOA0.x3d...
>> Attribute "level" is required and must be specified for element type
>> "component".
>> XML DTD validation: fail!
>>
>> Performing X3D schema validation...
>> Checking file:/C:/Users/john/X3DJSONLD/blend/DiamondManLOA0.x3d...
>> Referenced entity at "
>> http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
>> ".
>> Referenced entity at "http://www.w3.org/2001/XMLSchema.dtd".
>> Referenced entity at "http://www.w3.org/2001/datatypes.dtd".
>> Attribute "level" is required and must be specified for element type
>> "component".
>> cvc-complex-type.4: Attribute 'level' must appear on element 'component'.
>> XML schema validation: fail!
>>
>> Performing X3D regular expression (regex) values check...
>> X3D regex check: complete
>>
>> Performing X3dToX3dvClassicVrmlEncoding.xslt conversion check...
>> Error checking type of the expression 'funcall(ends-with,
>> [funcall(local-name, [step("parent", -1)]), literal-expr(Filter)])'.
>> Error checking type of the expression 'funcall(ends-with,
>> [funcall(local-name, [step("parent", -1)]), literal-expr(Filter)])'.
>>
>> Performing X3D Schematron check...
>>
>> Enjoy fixing!
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231104/b8180b19/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 158684 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231104/b8180b19/attachment-0001.png>
More information about the x3d-public
mailing list