[x3d-public] [x3d] Script Node and JSON encoding for X3D

Aaron Bergstrom flickertail at gmail.com
Mon May 4 19:14:28 PDT 2015


Is there a debate between using "-childNodeFieldNameNotFound" and "-field"?
Or are both required? Seems a bit much to require
"-childNodeFieldNameNotFound".

So would the following be correct for a script node? Specifically, I'm
wondering if line 12 should be "@value" or "-value" because it's an array.

{
     "Script":
     {
          "-field":
          [
               {
                    "field":
                    {
                         "@name":"textureField",
                         "@type":"MFNode",
                         "@accessType":"initializeOnly",
                         "@value":
                         [
                              {
                                   "ImageTexture":
                                   {
                                        "@DEF":"Image1",

"@url":["image1.png","images/image1.png"]
                                   }
                              },
                              {
                                   "ImageTexture":
                                   {
                                        "@DEF":"Image2",

"@url":["image2.png","images/image2.png"]
                                   }
                              }
                         ]
                     }
               }
          ]
     }
}

On Mon, May 4, 2015 at 6:28 PM, Don Brutzman <brutzman at nps.edu> wrote:

> cc: x3d-public (hope copying this answer out to community is OK with you
> Aaron, apologies if not)
>
> On 5/3/2015 10:13 PM, Aaron Bergstrom wrote:
>
>> Is there an example of a Script node in X3D JSON format that I can look
>> at?
>>
>
> All of the source examples in the following include JSON (draft encoding)
> conversions.
>
> X3D Example Archives: X3D for Web Authors, Chapter 09 - Event Utilities
> Scripting
>
> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter09-EventUtilitiesScripting/
>
> Example:
>
> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter09-EventUtilitiesScripting/ScriptControlEvents.x3d
>
> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter09-EventUtilitiesScripting/ScriptControlEvents.js
>
> and
>
> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter09-EventUtilitiesScripting/ScriptControlEvents.json
>
> JSON excerpt below.
>
> We do not yet have a final convention for the best way to handle
> - Script/field*
> - ProtoDeclare/ProtoInterface/field*
> - ProtoInterface/fieldValue*
>
> I doubt the following will change a whole lot.  Probably more interesting
> is how people will write native Javascript up at the HTML level to animate
> a scene graph- we could use more examples like that.  Maybe this scene is
> good for starting that.
>
> Also interesting is whether X3DOM might be able to load and execute
> Javascript in the X3D Script node without having to otherwise convert it.
> I believe that is possible... with a SMOP.   8)
>
> Small matter of programming (SMOP)
> https://en.wikipedia.org/wiki/Small_matter_of_programming
>
> Others mileage may vary regarding JSON/HTML/X3D integration... these ideas
> will be really interesting to develop and test out.  As with most other
> "hard" parts of X3D, implementation evaluation and spiral improvement will
> get us to creating another "easy" part of X3D.
>
> ===========================
>         { "Script":
>           {
>             "@DEF":"ControlScript",
>             "@url":["ScriptControlEvents.js", "
> http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter09-EventUtilitiesScripting/ScriptControlEvents.js
> "],
>             "@directOutput":false,
>             "@mustEvaluate":false,
>             "-childNodeFieldNameNotFound":[
>       ,
>               { "field":
>                 {
>                   "@accessType":"inputOnly",
>                   "@name":"buttonMotionDone",
>                   "@type":"SFBool"
>                 }
>               },
>               { "field":
>                 {
>                   "@accessType":"outputOnly",
>                   "@name":"motion",
>                   "@type":"MFVec3f"
>                 }
>               },
>               { "field":
>                 {
>                   "@accessType":"initializeOnly",
>                   "@name":"buttonDown",
>                   "@type":"SFBool",
>                   "@value":true
>                 }
>               },
>               { "field":
>                 {
>                   "@accessType":"outputOnly",
>                   "@name":"lightColor",
>                   "@type":"SFColor"
>                 }
>               }
>             ]
>             "-field":[
>               { "field":
>                 {
>                   "@accessType":"inputOnly",
>                   "@name":"buttonMotionDone",
>                   "@type":"SFBool"
>                 }
>               },
>               { "field":
>                 {
>                   "@accessType":"outputOnly",
>                   "@name":"motion",
>                   "@type":"MFVec3f"
>                 }
>               },
>               { "field":
>                 {
>                   "@accessType":"initializeOnly",
>                   "@name":"buttonDown",
>                   "@type":"SFBool",
>                   "@value":true
>                 }
>               },
>               { "field":
>                 {
>                   "@accessType":"outputOnly",
>                   "@name":"lightColor",
>                   "@type":"SFColor"
>                 }
>               }
>             ]
>           }
>         },
>         { "ROUTE":
>           {
>             "@fromField":"isActive",
>             "@fromNode":"ButtonTimer",
>             "@toField":"buttonMotionDone",
>             "@toNode":"ControlScript"
>           }
>         },
> ===========================
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20150504/0bbdb88b/attachment-0001.html>


More information about the x3d-public mailing list