[x3d-public] X3dToJson.xslt HAnim -metadata is replaced with -value on

John Carlson yottzumm at gmail.com
Thu Dec 23 23:17:06 PST 2021


Can't otherwise debug JinLOA4.java (warnings from my version shown 
below).  No automated comparison possible.  I may try to write a Java 
parser over Xmas break, so we can avoid these "code too large" errors.   
Confirmed source .x3d is comparable to the archives.  Previous fault in 
JinLOA4.json noted again (-value instead of correct -metadata between 
HAnimHumanoid and MetadataSet).

Please confirm that JinLOA4.x3d passes the XML validator, I am pretty 
sure it will.

The nub of the issue is conversion from XML to JSON.

Warning: HAnimJoint name newValue='l_tarsal_distal_interphalangeal_1' 
has an unrecognized value not matching any of the optional string tokens.
Warning: HAnimJoint name newValue='r_tarsal_distal_interphalangeal_1' 
has an unrecognized value not matching any of the optional string tokens.
org.web3d.x3d.sai.InvalidFieldException: ERROR_ILLEGAL_VALUE: 
HAnimSegment DEF='hanim_sacrum' name='sacrum' illegal parent found: 
HAnimJoint name='hanim_humanoid_root' name='humanoid_root'
org.web3d.x3d.sai.InvalidFieldException: ERROR_ILLEGAL_VALUE: 
HAnimSegment DEF='hanim_sacrum' name='sacrum' illegal parent found: 
HAnimJoint name='hanim_humanoid_root' name='humanoid_root'
     at 
org.web3d.x3d.jsail.HAnim.HAnimSegment.validate(HAnimSegment.java:6169)
     at org.web3d.x3d.jsail.HAnim.HAnimJoint.validate(HAnimJoint.java:7162)
     at 
org.web3d.x3d.jsail.HAnim.HAnimHumanoid.validate(HAnimHumanoid.java:6017)
     at org.web3d.x3d.jsail.Core.Scene.validate(Scene.java:870)
     at org.web3d.x3d.jsail.Core.X3D.validate(X3D.java:3988)
     at 
org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1118)
     at 
org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1042)
     at org.web3d.x3d.jsail.Core.X3D.toFileJSON(X3D.java:1853)
     at net.coderextreme.data.JinLOA4.main(JinLOA4.java:43)
Exception in thread "main" org.web3d.x3d.sai.InvalidFieldException: 
ERROR_ILLEGAL_VALUE: HAnimSegment DEF='hanim_sacrum' name='sacrum' 
illegal parent found: HAnimJoint name='hanim_humanoid_root' 
name='humanoid_root'
     at 
org.web3d.x3d.jsail.HAnim.HAnimSegment.validate(HAnimSegment.java:6169)
     at org.web3d.x3d.jsail.HAnim.HAnimJoint.validate(HAnimJoint.java:7162)
     at 
org.web3d.x3d.jsail.HAnim.HAnimHumanoid.validate(HAnimHumanoid.java:6017)
     at org.web3d.x3d.jsail.Core.Scene.validate(Scene.java:870)
     at org.web3d.x3d.jsail.Core.X3D.validate(X3D.java:3988)
     at 
org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1118)
     at 
org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1042)
     at org.web3d.x3d.jsail.Core.X3D.toFileJSON(X3D.java:1853)
     at net.coderextreme.data.JinLOA4.main(JinLOA4.java:43)

On 12/24/21 00:39, John Carlson wrote:
>
> I think there's still a error in X3dToJson.xslt, conversion from XML 
> to JSON produces
>
> [snippet]
>
> { "HAnimHumanoid":
>             {
>               "@name":"JinLOA4",
>               "@DEF":"hanim_JinLOA4",
>               "@loa":4,
>               "@scale":[0.0225,0.0225,0.0225],
>               "@version":"2.0",
> _*              "-value":[ *_
>                 { "MetadataSet":
>                   {              "-value":[
>
>
> I believe this affects all my downstream serialzers.
>
> I will double check that I am using the stylesheet.
>
> John
>
> On 12/23/21 13:50, Brutzman, Donald (Don) (CIV) wrote:
>>
>> Hi John, thanks for this elaboration of the question.  Here is an 
>> in-depth explanation giving multiple related references that answer 
>> the question: yes, the /metadata/ field is part of HAnimHumanoid node.
>>
>> More precise URL for HAnimHumanoid in HAnim v2.0 specification is
>>
>>   * Part 1: Humanoid animation (HAnim) architecture, Clause 6 Object
>>     Interfaces, 6.2 Humanoid
>>   * https://www.web3d.org/documents/specifications/19774-1/V2.0/Architecture/Obje
>>     Part 1:  Humanoid animation (HAnim)
>>     architecturectInterfaces.html#Humanoid
>>
>> HAnim architecture specification is abstract and must be implemented 
>> by other specifications. Thus you have to look in X3D Architecture 
>> specification for corresponding X3D details.
>>
>> Corresponding X3D Architecture specification is
>>
>>   * X3D4 Part 1: Architecture and base components, 26 Humanoid
>>     Animation (HAnim) component, clause 26.3.2 HAnimHumanoid
>>   * https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/hanim.html#HAnimHumanoid
>>
>> HAnimHumanoid : X3DChildNode, X3DBoundedObject {
>>
>>   SFVec3f    [in,out] center                0 0 0    (-∞,∞)
>>
>>   SFString   [in,out] description           ""
>>
>>   SFBool     [in,out] bboxDisplay           FALSE
>>
>>   SFBool     [in,out] visible               TRUE
>>
>>   MFString   [in,out] info                  []
>>
>>   MFVec3f    [in,out] jointBindingPositions []       (-∞,∞)
>>
>>   MFRotation [in,out] jointBindingRotations []       (-∞,∞)|[-1,1]
>>
>>   MFVec3f    [in,out] jointBindingScales    []       (0,∞)
>>
>>   MFNode     [in,out] joints                []       [HAnimJoint]
>>
>>   SFInt32    [in,out] loa                   -1       [-1,4]
>>
>>   SFNode     [in,out] metadata              NULL     [X3DMetadataObject]
>>
>>   MFNode     [in,out] motions               []       [HAnimMotion]
>>
>>   MFBool     [in,out] motionsEnabled        []
>>
>>   SFString   [in,out] name                  ""
>>
>>   SFRotation [in,out] rotation              0 0 1 0  (-∞,∞)|[-1,1]
>>
>>   SFVec3f    [in,out] scale                 1 1 1    (0,∞)
>>
>>   SFRotation [in,out] scaleOrientation      0 0 1 0  (-∞,∞)|[-1,1]
>>
>>   MFNode     [in,out] segments              []       [HAnimSegment]
>>
>>   MFNode     [in,out] sites                 []       [HAnimSite]
>>
>>   SFString   [in,out] skeletalConfiguration "BASIC"
>>
>>   MFNode     [in,out] skeleton              []       [HAnimJoint, 
>> HAnimSite]
>>
>>   MFNode     [in,out] skin                  [] [IndexedFaceSet, 
>> X3DGroupingNode, Shape][IndexedFaceSet, IndexedFanSet, 
>> IndexedQuadSet, IndexedTriangleSet, IndexedTriangleStripSet]
>>
>>   SFNode     [in,out] skinBindingCoord      NULL     [X3DCoordinateNode]
>>
>>   SFNode     [in,out] skinBindingNormal     NULL     [X3DNormalNode]
>>
>>   SFNode     [in,out] skinCoord             NULL     [X3DCoordinateNode]
>>
>>   SFNode     [in,out] skinNormal            NULL     [X3DNormalNode]
>>
>>   SFVec3f    [in,out] translation           0 0 0    (-∞,∞)
>>
>>   SFString   [in,out] version               ""
>>
>>   MFNode     [in,out] viewpoints            []       [HAnimSite]
>>
>>   SFVec3f    [] bboxCenter            0 0 0    (-∞,∞)
>>
>>   SFVec3f    [] bboxSize              -1 -1 -1 [0,∞) or −1 −1 −1
>>
>> }
>>
>> As you can see, this node signature does include /metadata/ field.
>>
>> As you can also see, there is no /value/ field.
>>
>> Of note is that there is an HAnimHumanoid /info/ field for metadata 
>> information, an MFString array of “name=value” pairs.  Very clumsy to 
>> use in practice.  The X3D4 Architecture notes in 26.3.2 the preferred 
>> alternative approach:
>>
>>   * Metadata values from the /info/ field can be equivalently encoded
>>     via MetadataSet containing related X3DMetadataObject nodes.
>>
>> Conversions are provided by X3dTidy cleanup stylesheet, and converted 
>> examples online. (Not finding this information in X3D Scene Authoring 
>> Hints, will add it.)
>>
>>   * HumanoidAnimation X3D Examples Archive
>>   * https://www.web3d.org/x3d/content/examples/HumanoidAnimation
>>
>>   * X3D Example Archives: Humanoid Animation, Characters, Jin LOA 4
>>   * https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Characters/JinLOA4Index.html
>>   * https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Characters/JinLOA4.html#hanim_JinLOA4
>>
>> <HAnimHumanoid DEF='hanim_JinLOA4' loa='4' name='JinLOA4' scale='0.0225 
>> 0.0225 0.0225'>
>>
>>   <MetadataSet name='HAnimHumanoid.info' reference='https://www.web3d.org/documents/specifications/19774/V2.0/Architecture/ObjectInterfaces.html#Humanoid' containerField='metadata'> 
>>
>>
>>     <MetadataString containerField='value' name='authorName' value='Jin 
>> Hoon Lee and Min Joo Lee, Chul Hee Jung and Myeong Won Lee'/>
>> <MetadataString containerField='value' name='authorEmail' value='myeongwonlee at gmail.com'/> 
>>
>>     <MetadataString containerField='value' name='creationDate' value='31 
>> March 2011'/>
>>     <MetadataString containerField='value' name='gender' value='female'/> 
>>
>>     <MetadataFloat containerField='value' name='height' value='1.5'/>
>>     <MetadataString containerField='value' name='humanoidVersion' value='"2.0"'/> 
>>
>>
>>   </MetadataSet>
>>   <HAnimJoint DEF='hanim_humanoid_root' center='0 36.709999 
>> -0.707600' containerField='skeleton' name='humanoid_root'>
>>
>> Reviewing X3D Tooltips confirms this answer to your question, along 
>> with convenient links to clauses in both specifications.  (Each of 
>> the node names e.g. HAnimHumanoid links to the current X3D 
>> Architecture CD1 clause.)
>>
>>   * X3D Tooltips HAnimHumanoid
>>   * https://www.web3d.org/x3d/tooltips/X3dTooltips.html#HAnimHumanoid
>>
>> Now checking X3D Unified Object Model (X3DUOM) 
>> X3dUnifiedObjectModel-4.0.xml
>>
>>   * https://www.web3d.org/specifications
>>   * https://www.web3d.org/specifications/X3dUnifiedObjectModel-4.0.xml
>>
>>       <ConcreteNode name="HAnimHumanoid">
>>
>>          <InterfaceDefinition 
>> specificationUrl=”https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/hanim.html#HAnimHumanoid”
>>
>>                               appinfo="The HAnimHumanoid node is used 
>> to: (a) store references to the joints, segments, sites, skeleton, 
>> optional skin, and fixed viewpoints, (b) serve as a container for the 
>> entire humanoid, (c) provide a convenient way of moving the humanoid 
>> through its environment, and (d) store human-readable metadata such 
>> as name, version, author, copyright, age, gender and other information.">
>>
>>             <componentInfo name="HAnim" level="1"/>
>>
>>             <Inheritance baseType="X3DChildNode"/>
>>
>>             <AdditionalInheritance baseType="X3DBoundedObject"/>
>>
>>             <field name="bboxCenter"
>>
>>                    type="SFVec3f"
>>
>> accessType="initializeOnly"
>>
>>                    default="0 0 0"
>>
>> inheritedFrom="X3DBoundedObject"
>>
>> description="Bounding box center accompanies bboxSize and provides an 
>> optional hint for bounding box position offset from origin of local 
>> coordinate system."/>
>>
>>             <field name="bboxDisplay"
>>
>>                    type="SFBool"
>>
>> accessType="inputOutput"
>>
>>                    default="false"
>>
>> inheritedFrom="X3DBoundedObject"
>>
>>                    description="Whether to display bounding box for 
>> associated geometry, aligned with world coordinates."/>
>>
>>             <field name="bboxSize"
>>
>>                    type="SFVec3f"
>>
>> accessType="initializeOnly"
>>
>>                    default="-1 -1 -1"
>>
>> inheritedFrom="X3DBoundedObject"
>>
>> baseType="bboxSizeType"
>>
>> description="Bounding box size is usually omitted, and can easily be 
>> calculated automatically by an X3D player at scene-loading time with 
>> minimal computational cost."/>
>>
>>             <field name="center"
>>
>>                    type="SFVec3f"
>>
>> accessType="inputOutput"
>>
>>                   default="0 0 0"
>>
>> description="Translation offset from origin of local coordinate 
>> system."/>
>>
>>             <field name="description"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> description="Author-provided prose that describes intended purpose of 
>> this node."/>
>>
>>             <field name="info"
>>
>>                    type="MFString"
>>
>> accessType="inputOutput"
>>
>> description="Contains metadata keyword=value pairs, where approved 
>> keyword terms are humanoidVersion authorName authorEmail copyright 
>> creationDate usageRestrictions age gender height and weight."/>
>>
>>             <field name="IS"
>>
>>                    type="SFNode"
>>
>> accessType="inputOutput"
>>
>>                    default="NULL"
>>
>> acceptableNodeTypes="IS"
>>
>> inheritedFrom="X3DNode"/>
>>
>>             <field name="jointBindingPositions"
>>
>>                    type="MFVec3f"
>>
>> accessType="inputOutput"
>>
>>                    default="0 0 0"
>>
>> description="Specifies an array of position values for each 
>> HAnimJoint node in the joints field, in order, corresponding to each 
>> binding pose."/>
>>
>>             <field name="jointBindingRotations"
>>
>>                    type="MFRotation"
>>
>> accessType="inputOutput"
>>
>>                    default="0 0 1 0"
>>
>> description="Specifies an array of rotation values for each 
>> HAnimJoint node in the joints field, in order, corresponding to each 
>> binding pose."/>
>>
>>             <field name="jointBindingScales"
>>
>>                    type="MFVec3f"
>>
>> accessType="inputOutput"
>>
>>                    default="0 0 0"
>>
>> description="Specifies an array of scale values for each HAnimJoint 
>> node in the joints field, in order, corresponding to each binding 
>> pose."/>
>>
>>             <field name="joints"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="HAnimJoint"
>>
>>                    description="The joints field contains a list of 
>> USE references for all HAnimJoint node instances found within the 
>> preceding skeleton hierarchy."/>
>>
>>             <field name="loa"
>>
>>                    type="SFInt32"
>>
>> accessType="inputOutput"
>>
>>                    default="-1"
>>
>>                    minInclusive="-1"
>>
>>                    maxInclusive="4"
>>
>>                    baseType="loaType"
>>
>>                    description="Level Of Articulation 0."/>
>>
>>             <field name="metadata"
>>
>>                    type="SFNode"
>>
>> accessType="inputOutput"
>>
>>                    default="NULL"
>>
>> acceptableNodeTypes="X3DMetadataObject"
>>
>>   inheritedFrom="X3DNode"
>>
>> description="Information about this node can be contained in a 
>> MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, 
>> MetadataString or MetadataSet node."/>
>>
>>             <field name="motions"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="HAnimMotion"
>>
>> description="Contains any HAnimMotion nodes that can animate the 
>> HAnimHumanoid."/>
>>
>>             <field name="name"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> baseType="xs:NMTOKEN"
>>
>>                    description="Unique name attribute must be defined 
>> so that each HAnimHumanoid node in a scene can be identified at run 
>> time for animation purposes."/>
>>
>>             <field name="rotation"
>>
>>                    type="SFRotation"
>>
>>      accessType="inputOutput"
>>
>>                    default="0 0 1 0"
>>
>> description="Orientation of children relative to local coordinate 
>> system."/>
>>
>>             <field name="scale"
>>
>>                    type="SFVec3f"
>>
>> accessType="inputOutput"
>>
>>                    default="1 1 1"
>>
>>                    minExclusive="0"
>>
>> description="Non-uniform x-y-z scale of child coordinate system, 
>> adjusted by center and scaleOrientation."/>
>>
>>             <field name="scaleOrientation"
>>
>>                    type="SFRotation"
>>
>> accessType="inputOutput"
>>
>>                    default="0 0 1 0"
>>
>> description="Preliminary rotation of coordinate system before scaling 
>> (to allow scaling around arbitrary orientations)."/>
>>
>>             <field name="segments"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="HAnimSegment"
>>
>>                    description="The segments field contains a list of 
>> USE references for all HAnimSegment node instances found within the 
>> preceding skeleton hierarchy."/>
>>
>>             <field name="sites"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="HAnimSite"
>>
>>                    description="sites field contains a list of USE 
>> references for all HAnimSite node instances found within the 
>> preceding skeleton hierarchy."/>
>>
>>             <field name="skeletalConfiguration"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>>                    default="BASIC"
>>
>>                    description="Models sharing a common skeletal 
>> configuration can share animations and binding poses."/>
>>
>>             <field name="skeleton"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="HAnimJoint|HAnimSite"
>>
>>                    description="List of top-level HAnimJoint and 
>> HAnimSite nodes that create the skeleton model."/>
>>
>>             <field name="skin"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="Group|Transform|Shape|IndexedFaceSet"
>>
>>                    description="List of one or more indexed mesh 
>> definitions (such as IndexedFaceSet) that utilize skinCoord point and 
>> skinNormal normal data."/>
>>
>>             <field name="skinBindingCoord"
>>
>>                    type="SFNode"
>>
>> accessType="inputOutput"
>>
>>                    default="NULL"
>>
>> acceptableNodeTypes="X3DCoordinateNode"
>>
>>                    description="Array of Coordinate nodes to handle 
>> non-default source pose so that both skin and skeleton can be in same 
>> binding pose."/>
>>
>>             <field name="skinBindingNormal"
>>
>>                    type="SFNode"
>>
>> accessType="inputOutput"
>>
>>                    default="NULL"
>>
>> acceptableNodeTypes="X3DNormalNode"
>>
>>                    description="Array of Normal nodes to handle 
>> non-default source pose so that both skin and skeleton can be in same 
>> binding pose."/>
>>
>>             <field name="skinCoord"
>>
>>                    type="SFNode"
>>
>> accessType="inputOutput"
>>
>>                    default="NULL"
>>
>> acceptableNodeTypes="X3DCoordinateNode"
>>
>> description="Coordinate node utilized by indexed mesh definitions for 
>> skin."/>
>>
>>             <field name="skinNormal"
>>
>>                    type="SFNode"
>>
>> accessType="inputOutput"
>>
>>                    default="NULL"
>>
>> acceptableNodeTypes="X3DNormalNode"
>>
>>                    description="Single Normal node utilized by 
>> indexed mesh definitions for skin."/>
>>
>>             <field name="translation"
>>
>>                    type="SFVec3f"
>>
>> accessType="inputOutput"
>>
>>                    default="0 0 0"
>>
>> description="Position of children relative to local coordinate system."/>
>>
>>             <field name="version"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>>                    default="2.0"
>>
>> additionalEnumerationValuesAllowed="false"
>>
>> simpleType="hanimVersionChoices"
>>
>> baseType="xs:NMTOKEN"
>>
>>  description="HAnimHumanoid version, where value is 1.">
>>
>>                <enumeration value="1.0"
>>
>> appinfo="International standard HAnim 19774 version 1 approved by ISO 
>> in 2006. Note that HAnim version 2.0 has more capabilties, while 
>> version 1.0 includes several small incompatibilities. Since no other 
>> versions were formally approved, no other values are allowed for 
>> earlier HAnim versions."
>>
>> documentation="https://www.web3d.org/documents/specifications/19774/V1.0" 
>> />
>>
>>                <enumeration value="2.0"
>>
>> appinfo="Revised standard HAnim 19774 version 2 (parts 1 and 2) were 
>> approved by ISO in November 2019, published by Web3D Consortium May 
>> 2020."
>>
>> documentation="https://www.web3d.org/documents/specifications/19774/V2.0" 
>> />
>>
>>             </field>
>>
>>             <field name="viewpoints"
>>
>>                    type="MFNode"
>>
>> accessType="inputOutput"
>>
>> acceptableNodeTypes="HAnimSite"
>>
>>                    description="List of HAnimSite nodes containing 
>> Viewpoint nodes that appear in the skeleton model, usually as USE 
>> node references."/>
>>
>>             <field name="visible"
>>
>>                    type="SFBool"
>>
>> accessType="inputOutput"
>>
>>                    default="true"
>>
>> inheritedFrom="X3DBoundedObject"
>>
>>                    description="Whether or not renderable content 
>> within this node is visually displayed."/>
>>
>>             <field name="DEF"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> inheritedFrom="X3DNode"
>>
>>                    baseType="xs:ID"
>>
>>                    description="DEF defines a unique ID name for this 
>> node, referenceable by other nodes."/>
>>
>>             <field name="USE"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> inheritedFrom="X3DNode"
>>
>>                    baseType="xs:IDREF"
>>
>>                    description="USE means reuse an already DEF-ed 
>> node ID, excluding all child nodes and all other attributes (except 
>> for containerField, which can have a different value)."/>
>>
>>             <field name="class"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> inheritedFrom="X3DNode"
>>
>> baseType="xs:NMTOKENS"
>>
>>                    description="The class attribute on each X3D node 
>> and statement is a space-separated list of classes, reserved for use 
>> by Cascading Style Sheets (CSS) and XML stylesheets."/>
>>
>>             <field name="id"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> inheritedFrom="X3DNode"
>>
>> baseType="xs:NMTOKEN"
>>
>>                    description="The id attribute on each X3D node and 
>> statement is considered a unique identifier when used as part of an 
>> encompassing HTML/DOM context."/>
>>
>>             <field name="style"
>>
>>                    type="SFString"
>>
>> accessType="inputOutput"
>>
>> inheritedFrom="X3DNode"
>>
>>                    description="The style attribute on each X3D node 
>> and statement provides an inline block of CSS source for element 
>> styling, reserved for use by Cascading Style Sheets (CSS) and XML 
>> stylesheets."/>
>>
>>             <containerField default="children" type="xs:NMTOKEN"/>
>>
>>             <ContentModel>
>>
>>                <GroupContentModel name="ChildContentModelCore" 
>> minOccurs="0"/>
>>
>>                <NodeContentModel name="HAnimJoint" minOccurs="0" 
>> maxOccurs="unbounded"/>
>>
>>                <NodeContentModel name="HAnimSegment" minOccurs="0" 
>> maxOccurs="unbounded"/>
>>
>>                <NodeContentModel name="HAnimSite" minOccurs="0" 
>> maxOccurs="unbounded"/>
>>
>>                <NodeContentModel name="HAnimMotion" minOccurs="0" 
>> maxOccurs="unbounded"/>
>>
>>                <NodeContentModel name="Group"/>
>>
>>                <NodeContentModel name="Transform"/>
>>
>>                <NodeContentModel name="Shape"/>
>>
>>                <NodeContentModel name="IndexedFaceSet"/>
>>
>>                <NodeContentModel name="Coordinate"/>
>>
>>                <NodeContentModel name="CoordinateDouble"/>
>>
>>                <NodeContentModel name="Normal" minOccurs="0" 
>> maxOccurs="2"/>
>>
>>                <NodeContentModel name="ProtoInstance" minOccurs="0" 
>> maxOccurs="unbounded"/>
>>
>>             </ContentModel>
>>
>>          </InterfaceDefinition>
>>
>>       </ConcreteNode>
>>
>> Regarding python, I checked the conversion of JinLOA4.x3d to JinLOA4.py
>>
>> Stylesheet X3dToPython.xstl seemed to work OK
>>
>> HAnimHumanoid(DEF='hanim_JinLOA4',loa=4,name='JinLOA4',scale=(0.0225,0.0225,0.0225),version='2.0',
>>
>>       skeleton=[
>>
>> HAnimJoint(DEF='hanim_humanoid_root',center=(0,36.709999,-0.707600),name='humanoid_root',stiffness=[0,0,0],
>>
>> but then got a self-validation error by the JinLOA4.py python program,
>>
>> create python:
>>
>> C:\x3d-code\www.web3d.org\x3d\content\examples\HumanoidAnimation/Characters//JinLOA4.x3d 
>> processing with X3dToPython stylesheet...
>>
>> C:\x3d-code\www.web3d.org\x3d\content\examples\HumanoidAnimation/Characters//JinLOA4.py 
>> self-validation tests...
>>
>> validate python:
>>
>> x3d.py package loaded, have fun with X3D Graphics!
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "C:\x3d-code\www.web3d.org\x3d\content\examples\HumanoidAnimation\Characters\JinLOA4.py", 
>> line 169, in <module>
>>
>> HAnimJoint(DEF='hanim_l_tarsal_distal_interphalangeal_1',center=(2.761,0.539400,5.125),name='l_tarsal_distal_interphalangeal_1',stiffness=[0,0,0],
>>
>>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\x3d\x3d.py", 
>> line 43724, in __init__
>>
>>     self.stiffness = stiffness
>>
>>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\x3d\x3d.py", 
>> line 43873, in stiffness
>>
>>     assertValidSFVec3f(stiffness)
>>
>>   File "C:\x3d-code\www.web3d.org\x3d\stylesheets\python\x3d\x3d.py", 
>> line 3953, in assertValidSFVec3f
>>
>>     raise X3DTypeError(str(value)[:100] + ', type=' + 
>> str(type(value)) + ' is not a valid Python tuple for SFVec3f')
>>
>> x3d.X3DTypeError: [0, 0, 0], type=<class 'list'> is not a valid 
>> Python tuple for SFVec3f
>>
>> Result: 1
>>
>> Note how stiffness=[0,0,0]was given as a list in brackets, rather 
>> than a tuple value in parentheses stiffness=(0,0,0) as might be 
>> expected for SFVec3f, and so this is a useful diagnostic.
>>
>> However the actual specification type for stiffness is MFFloat.  
>> (This was a mantis issue, might we tighten it to SFVec3f, but decided 
>> to keep it MFFloat in case more-advanced kinematics engines were 
>> someday of interest.
>>
>> * 
>> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/hanim.html#HAnimJoint
>>
>> 26.3.3 HAnimJoint
>>
>> HAnimJoint : X3DGroupingNode {
>>
>> […]
>>
>>   MFFloat    [in,out] stiffness        [0 0 0]  [0,1]
>>
>> Applied change to X3D DTD, X3D XML Schema and again autogenerated 
>> X3DUOM and x3d.py and X3D Ontology to match.
>>
>> 23 DEC 2021, carlson brutzman
>>
>> - restore type of HAnimJoint stiffness field as MFFloat (vice 
>> SFVec3f) to match
>>
>>   specification, since more-advanced kinematics engines might someday 
>> hold interest.
>>
>> This fixed the stiffness error.
>>
>> However, next got a surprising conversion error (which might have 
>> been what you experienced originally):
>>
>> =====================
>>
>> create python:
>>
>> C:\x3d-code\www.web3d.org\x3d\content\examples\HumanoidAnimation/Characters//JinLOA4.x3d 
>> processing with X3dToPython stylesheet...
>>
>> C:\x3d-code\www.web3d.org\x3d\content\examples\HumanoidAnimation/Characters//JinLOA4.py 
>> self-validation tests...
>>
>> validate python:
>>
>> x3d.py package loaded, have fun with X3D Graphics!Traceback (most 
>> recent call last):
>>
>>   File 
>> "C:\x3d-code\www.web3d.org\x3d\content\examples\HumanoidAnimation\Characters\JinLOA4.py", 
>> line 50, in <module>
>>
>> HAnimHumanoid(DEF='hanim_JinLOA4',loa=4,name='JinLOA4',scale=(0.0225,0.0225,0.0225),version='2.0',
>>
>> TypeError: HAnimHumanoid.__init__() got an unexpected keyword 
>> argument 'value'
>>
>> Result: 1
>>
>> =====================
>>
>> Which apparently was on line 1950,
>>
>> value=MetadataSet(name='HAnimHumanoid.info',reference='https://www.web3d.org/documents/specifications/19774/V2.0/Architecture/ObjectInterfaces.html#Humanoid',etc.
>>
>> This conversion should have been metadata=MetadataSet etc. Looks like 
>> the field name for the HAnimHumanoid MetadataSet was not specified 
>> incorrectly, the automatic conversion by X3dTidy did not apply 
>> correct containerField value.
>>
>> I have added a rule to X3dTidy.xslt that looks for this case (for 
>> either representation, X3D3 or X3D4) and corrects it.  I have added a 
>> similar diagnostic rule to X3dSchematron checks.
>>
>> All affected HAnimHumanoid scenes have been updated and are now 
>> getting compiled correctly by Python.
>>
>> All changes checked into subversion. Further regression testing 
>> continuing, website uploads to follow.
>>
>> So again thanks for exposing this issue.  Pretty complex but 
>> resolvable.  Once again the strict nature of Python aided us in 
>> achieving high Quality Assurance (QA) for X3D.
>>
>> Happy holidays with X3D!   8)
>>
>> all the best, Don
>>
>> -- 
>>
>> Don Brutzman  Naval Postgraduate School, Code USW/Br brutzman at nps.edu
>>
>> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    
>> +1.831.656.2149
>>
>> X3D graphics, virtual worlds, navy robotics https:// 
>> faculty.nps.edu/brutzman
>>
>> *From:* John Carlson <yottzumm at gmail.com>
>> *Sent:* Wednesday, December 22, 2021 12:44 PM
>> *To:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>; X3D Graphics 
>> public mailing list <x3d-public at web3d.org>
>> *Subject:* Re: HAnim, X3dToPython.xslt X3dToJson.xslt Upgrade X3DUOM?
>>
>> I believe I checked the right standard, here:
>>
>> https://www.web3d.org/documents/specifications/19774-1/V2.0/index.html
>>
>>  And neither value or metadata is a field????
>>
>> Seems a bit strange.
>>
>> On Wed, Dec 22, 2021 at 2:20 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>     hoping to see value field added to HAnimHumanoid in X3DUOM, or
>>     some notice that the package generating stylesheets are not
>>     up-to-date.
>>
>>     Also, check to make sure stiffness is assigned the right data
>>     structure (between list and tuple).   And no, iOS, I do not want
>>     “Tupperware” for the second time.   We need more women
>>     mathematicians (sorry for any stereotyping).  On that subject, I
>>     wonder what coordinate system crocheted hats use?
>>
>>     On Mon, Dec 20, 2021 at 3:17 AM John Carlson <yottzumm at gmail.com>
>>     wrote:
>>
>>         Okay, now I seem to be having a similar problem between my
>>         python serializer, X3dToPython.xslt, and probably other
>>         serialized stuff.  I couldn't figure out how to fix the
>>         stiffness issue in X3dToPython.xslt, but hand-editing saved
>>         that on this particular python file
>>         (python/net/x3djsonld/data/JinLOA4.py). Other JinLOA's still
>>         have lists with Don's generator.
>>
>>         I believe the main change I am dealing with is metadata vs
>>         value containerFields.   See JSON diff below.  I'm not seeing
>>         relevant changes to X3D JSON schema 4.0.  Does something need
>>         to be upgraded in X3DUOM or X3D JSON schema?  I'm not seeing
>>         a value field in HAnimHumanoid.
>>
>>         *~/X3DJSONLD/src/main/python/net/coderextreme/data*$ python
>>         JinLOA4.py
>>         Traceback (most recent call last):
>>          File
>>         "/home/coderextreme/X3DJSONLD/src/main/python/net/coderextreme/data/JinLOA4.py",
>>         line 148, in <module>
>>            HAnimHumanoid23.setValue(MetadataSet24)
>>         AttributeError: 'org.web3d.x3d.jsail.HAnim.HAnimHumanoid'
>>         object has no attribute 'setValue'. Did you mean: 'setName'?
>>         *~/X3DJSONLD/src/main/python/net/x3djsonld/data*$ python
>>         JinLOA4.py
>>         x3d.py package loaded, have fun with X3D Graphics!
>>         Traceback (most recent call last):
>>          File
>>         "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/JinLOA4.py",
>>         line 50, in <module>
>>            HAnimHumanoid(DEF='hanim_JinLOA4',loa=4,name='JinLOA4',scale=(0.0225,0.0225,0.0225),version='2.0',
>>
>>         TypeError: HAnimHumanoid.__init__() got an unexpected keyword
>>         argument 'value'
>>
>>
>>         *~/X3DJSONLD/src/main/data*$ git diff JinLOA4.json
>>         *diff --git a/src/main/data/JinLOA4.json
>>         b/src/main/data/JinLOA4.json*
>>         *index c970a652a..e1930f4cf 100644*
>>         *--- a/src/main/data/JinLOA4.json*
>>         *+++ b/src/main/data/JinLOA4.json*
>>         @@ -78,7 +78,7 @@
>>                   },
>>                   {
>>                     "@name":"translated",
>>         -            "@content":"14 October 2021"
>>         +            "@content":"20 December 2021"
>>                   },
>>                   {
>>                     "@name":"generator",
>>         @@ -116,7 +116,7 @@
>>                       "@loa":4,
>>                       "@scale":[0.0225,0.0225,0.0225],
>>                       "@version":"2.0",
>>         -              "-metadata":
>>         +              "-value":[
>>                         { "MetadataSet":
>>                           {
>>                             "@name":"HAnimHumanoid.info",
>>         @@ -160,7 +160,8 @@
>>                               }
>>                             ]
>>                           }
>>         -                },
>>         +                }
>>         +              ],
>>                       "-skeleton":[
>>                         { "HAnimJoint":
>>                           {
>>
>>         ===================
>>
>>         Validating JSON against schema:
>>
>>         *~/X3DJSONLD/src/main/schema*$ node
>>         ~/x3dvalidate/x3dvalidate.js ../data/JinLOA4.json
>>         Loading schema
>>         Parsing schema
>>         Adding schema
>>         Schema 4.0 added
>>         Schema 4.0 compiled
>>         ================================================================================
>>
>>         File: ../data/JinLOA4.json
>>         Error reading ../data/JinLOA4.json
>>         keyword: required
>>         instancePath: /X3D/Scene/-children/3/HAnimHumanoid
>>         message: must have required property @USE
>>         params: {"missingProperty":"@USE"}
>>         file: ../data/JinLOA4.json
>>         version: 4.0
>>
>>         keyword: additionalProperties
>>         instancePath: /X3D/Scene/-children/3/HAnimHumanoid
>>         message: must NOT have additional properties
>>         params: {"additionalProperty":"-value"}
>>         file: ../data/JinLOA4.json
>>         version: 4.0
>>
>>         keyword: oneOf
>>         instancePath: /X3D/Scene/-children/3/HAnimHumanoid
>>         message: must match exactly one schema in "oneOf"
>>         params: {"passingSchemas":null}
>>         file: ../data/JinLOA4.json
>>         version: 4.0
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211224/bac62739/attachment-0001.html>


More information about the x3d-public mailing list