[x3d-public] JSON encoding for SFNode: no [array brackets]

Roy Walmsley roy.walmsley at ntlworld.com
Fri Feb 19 07:38:24 PST 2016


Don,

Yes, I can check it in. What directory do we want it in? At the moment it is generated into the stylesheets directory. I suspect we would want it in the specifications directory. If so, I will add the appropriate instructions to the build to move it after auto generation.

The other point to bear in mind is that it is being generated from my local version of the V3.3 Schema. This is still ahead of the published version while you work through the outstanding Schema issues.

Roy

-----Original Message-----
From: Don Brutzman [mailto:brutzman at nps.edu] 
Sent: 19 February 2016 15:22
To: Roy Walmsley; 'John Carlson'
Cc: 'X3D Graphics public mailing list'
Subject: Re: JSON encoding for SFNode: no [array brackets]

Thanks for the catch.  Correction checked in, updated test result attached.  Examples should be again updated in time for our weekly JSON teleconference.

Another clarification: I got the types from X3DObjectModel-3.3.xml

	http://www.web3d.org/x3d/stylesheets/X3DObjectModel-3.3.xml

Roy, this is pretty mature, can we also check it into subversion?  The object-model document changes over time may be interesting.

On 2/19/2016 5:51 AM, Roy Walmsley wrote:
> Hi Don,
>
> Sorry to say you missed "material". I've changed my Schema, and using your new stylesheet I am regenerating the Basic archive JSON examples. I've started testing and noted that "material" fails. The 'Hello World" example can also be seen to still have the array.
>
> I'll modify the stylesheet, and rerun the example generation, and do some more testing. Obviously, not going to be ready for full test runs later!
>
> Roy
>
> -----Original Message-----
> From: Don Brutzman [mailto:brutzman at nps.edu]
> Sent: 19 February 2016 08:17
> To: John Carlson; Roy Walmsley; X3D Graphics public mailing list
> Subject: JSON encoding for SFNode: no [array brackets]
>
> John, during today's X3D Schema/DTD teleconference Roy observed that our SFNode child nodes were always wrapped in [array brackets] even though there is not an array there.
>
> This is contrary to our declared design principle that SFNode is always a JSON object.
>
> 	http://www.web3d.org/x3d/stylesheets/X3dToJson.html#values
>
> That definitely appears to be what we want.  No desire to mislead JSON authors into thinking that another node might appear.
>
> Fortunately this implementation wasn't too difficult.  Here is the list of SFNode types that I constructed from AllX3dElementsAttributes.3.3.xml
>
> <xsl:variable name="SFNodeType" select="
> 	($fieldName = 'back')               or ($fieldName = 'bottom')            or ($fieldName = 'front')              or
> 	($fieldName = 'left')               or ($fieldName = 'right')             or ($fieldName = 'top')                or
> 	($fieldName = 'backTexture')        or ($fieldName = 'bottomTexture')     or ($fieldName = 'frontTexture')       or
> 	($fieldName = 'leftTexture')        or ($fieldName = 'rightTexture')      or ($fieldName = 'topTexture')         or
> 	($fieldName = 'appearance')         or ($fieldName = 'body1')             or ($fieldName = 'body2')              or
> 	($fieldName = 'collidable')         or ($fieldName = 'collider')          or
> 	($fieldName = 'color')              or ($fieldName = 'colorRamp')         or ($fieldName = 'coord')              or
> 	($fieldName = 'controlPoint')       or ($fieldName = 'controlPoints')     or ($fieldName = 'crossSectionCurve')  or
> 	($fieldName = 'emitter')            or ($fieldName = 'fillProperties')    or
> 	($fieldName = 'fogCoord')           or ($fieldName = 'fontStyle')         or ($fieldName = 'geoOrigin')          or
> 	($fieldName = 'geometry')           or ($fieldName = 'geometry1')         or ($fieldName = 'geometry2')          or
> 	($fieldName = 'gradients')          or ($fieldName = 'layout')            or ($fieldName = 'lineProperties')     or
> 	($fieldName = 'massDensityModel')   or

($fieldName = 'material') or

> 	($fieldName = 'metadata')           or ($fieldName = 'normal')            or ($fieldName = 'pickingGeometry')    or
> 	($fieldName = 'profileCurve')       or ($fieldName = 'proxy')             or
> 	($fieldName = 'renderStyle')        or ($fieldName = 'source')            or
> 	($fieldName = 'segmentIdentifiers') or ($fieldName = 'surface')           or ($fieldName = 'surfaceNormals')     or
> 	($fieldName = 'targetObject')       or ($fieldName = 'texCoord')          or ($fieldName = 'texCoordRamp')       or
> 	($fieldName = 'texture')            or ($fieldName = 'textureProperties') or ($fieldName = 'textureTransform')   or
> 	($fieldName = 'trajectoryCurve')    or ($fieldName = 'transferFunction')  or
> 	($fieldName = 'viewpoint')          or ($fieldName = 'voxels')            or
> 	($fieldName = 'weightTransferFunction1') or ($fieldName = 'weightTransferFunction2') or
> 	($parentName='CADFace'         and $fieldName = 'shape') or
> 	($parentName='CollidableShape' and $fieldName = 'shape')" />
>
> So anyway it appears to be working on the first handful of test examples used during development.
>
> HelloWorld.json example attached, check out SFNode fields -appearance -geometry -material etc.  Output is slightly terser as well.
>
> No doubt this affects your implementation to but it appears to be an important change.
>
> Hope this sounds good to you too.  Chalk another win up for Roy's JSON schema!
>
> Stylesheet modifications checked in.  I'm running the JSON Examples build overnight, should be ready for you and Roy in the morning.
>
> http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples
> "Special testing distribution. A comprehensive collection of all JSON example scenes is available at X3dExampleArchivesJsonScenes.zip (MD5 checksum) plus current output from the X3D JSON build process at build.json.out."

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 http://faculty.nps.edu/brutzman




More information about the x3d-public mailing list