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

John Carlson yottzumm at gmail.com
Fri Feb 19 06:26:59 PST 2016


This may actually help my efforts to create an alternate X3D XML -> X3D JSON path.  Thanks!

John
> On Feb 19, 2016, at 3:16 AM, Don Brutzman <brutzman at nps.edu> wrote:
> 
> 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 = '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
> <HelloWorld.json>




More information about the x3d-public mailing list