{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"4.0",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-4.0.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"ExecutionModel.x3d"
          },
          {
            "@name":"description",
            "@content":"X3D encodings example: execution model demonstrated. Click ball to see script-generated text appear."
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman and Joe Williams"
          },
          {
            "@name":"created",
            "@content":"1 June 2002"
          },
          {
            "@name":"modified",
            "@content":"28 September 2025"
          },
          {
            "@name":"specificationSection",
            "@content":"X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.19 Execution model"
          },
          {
            "@name":"specificationUrl",
            "@content":"https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-1v4.0-CD/Part01/examples.html#ExecutionModel"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ExecutionModel.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"20 April 2026"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "WorldInfo":
            {
              "@title":"ExecutionModel.x3d"
            }
          },
          { "TouchSensor":
            {
              "@DEF":"TS",
              "@description":"click to animate"
            }
          },
          { "Script":
            {
              "@DEF":"Script1",
              "field": [
                {
                  "@name":"touchTime",
                  "@accessType":"inputOnly",
                  "@type":"SFTime"
                },
                {
                  "@name":"toScript2",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"toScript3",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"string",
                  "@accessType":"outputOnly",
                  "@type":"SFString"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function touchTime() {",
"        toScript2 = true;",
"      }",
"      function eventsProcessed() {",
"        string = 'Script1.eventsProcessed';",
"        toScript3 = true;",
"      }",
"",
""
]
            }
          },
          { "Script":
            {
              "@DEF":"Script2",
              "field": [
                {
                  "@name":"fromScript1",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"toScript4",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"string",
                  "@accessType":"outputOnly",
                  "@type":"SFString"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function fromScript1() {",
"      }",
"      function eventsProcessed() {",
"        string = 'Script2.eventsProcessed';",
"        toScript4 = true;",
"      }",
"",
""
]
            }
          },
          { "Script":
            {
              "@DEF":"Script3",
              "field": [
                {
                  "@name":"fromScript1",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"toScript5",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"toScript6",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"string",
                  "@accessType":"outputOnly",
                  "@type":"SFString"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function fromScript1() {",
"        toScript5 = true;",
"      }",
"      function eventsProcessed() {",
"        string = 'Script3.eventsProcessed';",
"        toScript6 = true;",
"      }",
"",
""
]
            }
          },
          { "Script":
            {
              "@DEF":"Script4",
              "field": [
                {
                  "@name":"fromScript2",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function fromScript2() {",
"      }",
"",
""
]
            }
          },
          { "Script":
            {
              "@DEF":"Script5",
              "field": [
                {
                  "@name":"fromScript3",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"       function fromScript3() {",
"      }",
"",
""
]
            }
          },
          { "Script":
            {
              "@DEF":"Script6",
              "field": [
                {
                  "@name":"fromScript3",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"toScript7",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"string",
                  "@accessType":"outputOnly",
                  "@type":"SFString"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function fromScript3() {",
"        toScript7 = true;",
"      }",
"      function eventsProcessed() {",
"        string = 'Script6.eventsProcessed';",
"      }",
"",
""
]
            }
          },
          { "Script":
            {
              "@DEF":"Script7",
              "field": [
                {
                  "@name":"fromScript6",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function fromScript6 () {",
"      }",
"",
""
]
            }
          },
          {
            "#comment":"Display the results"
          },
          { "Script":
            {
              "@DEF":"Collector",
              "field": [
                {
                  "@name":"string",
                  "@accessType":"outputOnly",
                  "@type":"MFString"
                },
                {
                  "@name":"fromString",
                  "@accessType":"inputOnly",
                  "@type":"SFString"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"      function initialize() {",
"        string[0] = 'Event Sequence:';",
"      }",
"      function fromString(s) {",
"        i = string.length;",
"        string[i] = ' ( ' + i + ' ) ' + s + ' occurred';",
"      }",
"",
""
]
            }
          },
          { "Transform":
            {
              "@translation":[0,2,0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                                "@diffuseColor":[0,0.6,0]
                              }
                            }
                        }
                      },
                    "-geometry":
                      { "Sphere":
                        {
                        }
                      }
                  }
                }
              ]
            }
          },
          { "Shape":
            {
              "-geometry":
                { "Text":
                  {
                    "@DEF":"Result"
                  }
                },
              "-appearance":
                { "Appearance":
                  {
                    "-material":
                      { "Material":
                        {
                          "@diffuseColor":[0.101961,0.839216,1]
                        }
                      }
                  }
                }
            }
          },
          { "Viewpoint":
            {
              "@description":"Execution model example",
              "@position":[7,-1,18]
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"TS",
              "@toField":"touchTime",
              "@toNode":"Script1"
            }
          },
          { "ROUTE":
            {
              "@fromField":"toScript2",
              "@fromNode":"Script1",
              "@toField":"fromScript1",
              "@toNode":"Script2"
            }
          },
          { "ROUTE":
            {
              "@fromField":"toScript3",
              "@fromNode":"Script1",
              "@toField":"fromScript1",
              "@toNode":"Script3"
            }
          },
          { "ROUTE":
            {
              "@fromField":"toScript4",
              "@fromNode":"Script2",
              "@toField":"fromScript2",
              "@toNode":"Script4"
            }
          },
          { "ROUTE":
            {
              "@fromField":"toScript5",
              "@fromNode":"Script3",
              "@toField":"fromScript3",
              "@toNode":"Script5"
            }
          },
          { "ROUTE":
            {
              "@fromField":"toScript6",
              "@fromNode":"Script3",
              "@toField":"fromScript3",
              "@toNode":"Script6"
            }
          },
          { "ROUTE":
            {
              "@fromField":"toScript7",
              "@fromNode":"Script6",
              "@toField":"fromScript6",
              "@toNode":"Script7"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string",
              "@fromNode":"Script1",
              "@toField":"fromString",
              "@toNode":"Collector"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string",
              "@fromNode":"Script2",
              "@toField":"fromString",
              "@toNode":"Collector"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string",
              "@fromNode":"Script3",
              "@toField":"fromString",
              "@toNode":"Collector"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string",
              "@fromNode":"Script6",
              "@toField":"fromString",
              "@toNode":"Collector"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string",
              "@fromNode":"Collector",
              "@toField":"string",
              "@toNode":"Result"
            }
          }
        ]
    }
  }
}