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

Don Brutzman brutzman at nps.edu
Fri Feb 19 07:23:51 PST 2016


1 & 2 are the right ideas, we are fixing the conversion to support the design principle.  SFNode entries get no array brackets, MFNode entries get array brackets.

On 2/19/2016 7:17 AM, Leonard Daly wrote:
> I think this first came up about a month ago. The idea of adding brackets around anything that could be an array was so that software that was processing the file did not either
> 1) know the structure of X3D
>
>     OR
>
> 2) Have to inquire the type of the structure at run-time
>
>
> It appears to me that the above reasoning is being discarded here. If I am wrong, please help correct my misunderstanding.
>
>
> Leonard Daly
>
>
>
>> 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
>>
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> --
> *Leonard Daly*
> 3D Systems & Cloud Consultant
> X3D Co-Chair on Sabbatical
> LA ACM SIGGRAPH Chair
> President, Daly Realism - /Creating the Future/
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>


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