<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Andreas,<br>
    <br>
    This message answers my last question in my previous message with
    the caveat that you don't know if it works yet.<br>
    <br>
    <br>
    Leonard Daly<br>
    <br>
    <br>
    <br>
    <blockquote type="cite"
cite="mid:CAKdk67tL_pnzZHe0fvvna7ZirA-nQ1Mw4AkPyW3ZT6FZsQU92Q@mail.gmail.com">
      <div dir="ltr">
        <div>Hi John, Leonard,<br>
          <br>
        </div>
        good point. cobweb_dom may not be necessary with <br>
        <div>
          <p class="MsoNormal"><a
              href="https://x3d-v4-mixed-scripting.glitch.me/"
              target="_blank" moz-do-not-send="true">https://x3d-v4-mixed-<wbr>scripting.glitch.me/</a></p>
          <p class="MsoNormal"><br>
          </p>
          <p class="MsoNormal">since it does not use direct DOM
            manipulation for the Scene.</p>
          <p class="MsoNormal"><br>
          </p>
          <p class="MsoNormal">With cobweb_dom you can in parallel still
            manipulate the scene via DOM API.<br>
          </p>
          <p class="MsoNormal"><br>
          </p>
          <p class="MsoNormal">I remembered that with cobweb_dom all x3d
            DOM elements get their x3d node object exposed as
            domNode.x3d . And, indeed, the x3d script element,
            x3dScript=document.querySelector("[DEF=INTERP]"), has a
            property .x3d which has the context array I had referred to
            earlier.</p>
          <p class="MsoNormal"><br>
          </p>
          <p class="MsoNormal">So x3dScript.x3d.context.set_fraction is
            actually available to an HTML script and could be redefined.
            It could be possible to directly redefine set_fraction()
            although I am not sure if there is a benefit.<br>
          </p>
          <p class="MsoNormal"><br>
          </p>
          <p class="MsoNormal">I am not sure if after it is redefined,
            the same 'with' expanded prototype chain (expanded global)
            still could be made to apply, and how the function context
            would work. Time for some more experiments.</p>
          <p class="MsoNormal"><br>
          </p>
          <p class="MsoNormal">-Andreas<br>
          </p>
        </div>
        <div>
          <div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">On Sun, Aug 13, 2017 at 12:52 PM,
                John Carlson <span dir="ltr"><<a
                    href="mailto:yottzumm@gmail.com" target="_blank"
                    moz-do-not-send="true">yottzumm@gmail.com</a>></span>
                wrote:<br>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">
                  <div lang="EN-US">
                    <div class="gmail-m_524162945316276436WordSection1">
                      <p class="MsoNormal">Thanks Andreas!  I would like
                        to add that you can load the Cobweb scene from
                        JSON with my extensions with HTML script, via
                        DOM (built into Cobweb—No need for Cobweb_dom). 
                        Now if only modifying the JS Object would modify
                        the X3D scene and vica versa (TODO, suggestion
                        to use Cobweb_dom instead).</p>
                      <p class="MsoNormal"> </p>
                      <p class="MsoNormal">I am wondering if the only
                        thing that was failing in my attempt to put
                        proxies in my JS “scenegraph” was that they only
                        had set proxies, and not get proxies, thus I
                        could not read the value from the proxy.</p>
                      <p class="MsoNormal"> </p>
                      <p class="MsoNormal">John</p>
                      <p class="MsoNormal"> </p>
                      <p class="MsoNormal">Sent from <a
                          href="https://go.microsoft.com/fwlink/?LinkId=550986"
                          target="_blank" moz-do-not-send="true">Mail</a>
                        for Windows 10</p>
                      <p class="MsoNormal"> </p>
                      <div style="border-width:1pt medium
                        medium;border-style:solid none
                        none;border-color:rgb(225,225,225) currentcolor
                        currentcolor;padding:3pt 0in 0in">
                        <p class="MsoNormal"
style="border-width:medium;border-style:none;border-color:currentcolor;padding:0in"><b>From:
                          </b><a href="mailto:andreasplesch@gmail.com"
                            target="_blank" moz-do-not-send="true">Andreas
                            Plesch</a><br>
                          <b>Sent: </b>Sunday, August 13, 2017 12:10 PM<br>
                          <b>To: </b><a
                            href="mailto:Leonard.Daly@realism.com"
                            target="_blank" moz-do-not-send="true">Leonard
                            Daly</a><br>
                          <b>Cc: </b><a
                            href="mailto:x3d-public@web3d.org"
                            target="_blank" moz-do-not-send="true">X3D
                            Graphics public mailing list</a>; <a
                            href="mailto:yottzumm@gmail.com"
                            target="_blank" moz-do-not-send="true">John
                            Carlson</a><br>
                          <b>Subject: </b>Re: Script Illustrative
                          Example [was: X3D Specification
                          Relationshipsdiagram]</p>
                      </div>
                      <p class="MsoNormal"> </p>
                      <div>
                        <div>
                          <p class="MsoNormal">And here is a version
                            which mixes x3d and html scripting:</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal"><a
                              href="https://x3d-v4-mixed-scripting.glitch.me/"
                              target="_blank" moz-do-not-send="true">https://x3d-v4-mixed-<wbr>scripting.glitch.me/</a></p>
                        </div>
                        <div>
                          <p class="MsoNormal">forkable source:</p>
                        </div>
                        <p class="MsoNormal"><a
href="https://glitch.com/edit/#%21/x3d-v4-mixed-scripting?path=index.html:69:4"
                            target="_blank" moz-do-not-send="true">https://glitch.com/edit/#!/<wbr>x3d-v4-mixed-scripting?path=<wbr>index.html:69:4</a></p>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">The idea to use a
                            redefinable global function in a x3d field
                            function worked fine.</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">Above now uses regular
                            x3d animation via timesensor and routes. The
                            x3d script acts as an interpolator accepting
                            set_fraction input. It does end up not using
                            the fraction since the original animation
                            was defined in terms of clock time. So the
                            script also uses timestamps and the original
                            changeY and linearX global html script
                            functions. The redefinition of changeY via
                            button names is unchanged.</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">It would be nicer to
                            define the interpolators in terms of a
                            fraction but that is secondary.</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">The x3dom approach would
                            be to use its onOutputChange event:</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> <a
href="https://doc.x3dom.org/tutorials/animationInteraction/onoutputchange/index.html"
                              target="_blank" moz-do-not-send="true">https://doc.x3dom.org/<wbr>tutorials/<wbr>animationInteraction/<wbr>onoutputchange/index.html</a></p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">for defining a custom
                            interpolator.</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">-Andreas</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                          <div>
                            <p class="MsoNormal">On Sat, Aug 12, 2017 at
                              10:40 AM, Andreas Plesch <<a
                                href="mailto:andreasplesch@gmail.com"
                                target="_blank" moz-do-not-send="true">andreasplesch@gmail.com</a>>
                              wrote:</p>
                            <blockquote style="border-width:medium
                              medium medium 1pt;border-style:none none
                              none solid;border-color:currentcolor
                              currentcolor currentcolor
                              rgb(204,204,204);padding:0in 0in 0in
                              6pt;margin-left:4.8pt;margin-right:0in">
                              <div>
                                <p class="MsoNormal">Hi Leonard,</p>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">here is a version
                                    of the example which uses cobweb
                                    with cobweb-dom for DOM API use.</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><a
                                      href="https://x3d-v4-scripting-cobweb.glitch.me/"
                                      target="_blank"
                                      moz-do-not-send="true">https://x3d-v4-scripting-<wbr>cobweb.glitch.me/</a></p>
                                </div>
                                <div>
                                  <p class="MsoNormal">and</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><a
href="https://glitch.com/edit/#%21/x3d-v4-scripting-cobweb?path=index.html:63:1"
                                      target="_blank"
                                      moz-do-not-send="true">https://glitch.com/edit/#!/<wbr>x3d-v4-scripting-cobweb?path=<wbr>index.html:63:1</a></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">The necessary
                                    changes were minor:</p>
                                </div>
                                <div>
                                  <p class="MsoNormal">- The display
                                    area div needed to be replaced with
                                    a x3d canvas</p>
                                </div>
                                <div>
                                  <p class="MsoNormal">- The ball div
                                    needed to become a sphere shape
                                    transform</p>
                                </div>
                                <div>
                                  <p class="MsoNormal">- The ball
                                    position is set via the translation
                                    attribute rather than position style
                                    properties.</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">The viewpoint is
                                    at a distance such that 1px in the
                                    original div rectangle corresponds
                                    to about 1m in the x3d scene when
                                    viewed from the viewpoint.</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">Otherwise no
                                    changes are needed since full
                                    control via the DOM API is possible.</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">I also found that
                                    I need to update cobweb-dom to work
                                    with the latest cobweb since there
                                    were some changes in the cobweb
                                    parser. The current cobweb-dom only
                                    works with cobweb < 3.0.</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">I suppose the
                                    next question is if one can use x3d
                                    scripts instead of the html scripts
                                    or somehow mix and match. What
                                    functionality should be provided in
                                    an x3d script ? The tricky thing to
                                    try maybe to do the animation inside
                                    x3d but replace the x3d interpolator
                                    with a custom interpolator from an
                                    html script ? Maybe I can think of
                                    something.</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal">-Andreas</p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                              </div>
                              <div>
                                <p class="MsoNormal"> </p>
                                <div>
                                  <p class="MsoNormal">On Sat, Aug 12,
                                    2017 at 1:13 AM, Andreas Plesch <<a
href="mailto:andreasplesch@gmail.com" target="_blank"
                                      moz-do-not-send="true">andreasplesch@gmail.com</a>>
                                    wrote:</p>
                                  <blockquote style="border-width:medium
                                    medium medium 1pt;border-style:none
                                    none none
                                    solid;border-color:currentcolor
                                    currentcolor currentcolor
                                    rgb(204,204,204);padding:0in 0in 0in
6pt;margin-left:4.8pt;margin-right:0in">
                                    <div>
                                      <div>
                                        <p class="MsoNormal">I went back
                                          to the cobweb repo to very
                                          carefully read through the
                                          rather mind bending script
                                          node code in </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"><a
href="https://github.com/create3000/cobweb/blob/master/cobweb.js/cobweb/Components/Scripting/Script.js"
                                            target="_blank"
                                            moz-do-not-send="true">https://github.com/create3000/<wbr>cobweb/blob/master/cobweb.js/<wbr>cobweb/Components/Scripting/<wbr>Script.js</a></p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal">and came to
                                          the conclusion that the x3d
                                          scripts are only evaled once
                                          during initialization,
                                          contrary to what I had
                                          thought. The script text is
                                          cleverly appended with an
                                          array of all defined named
                                          functions which then becomes
                                          the return value of the eval
                                          call. These functions are then
                                          stored in a local scope
                                          this.context object,
                                          essentially as methods. Then,
                                          whenever a lifecycle function
                                          or a field function needs to
                                          be executed, the context
                                          method is called.</p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal">One could
                                          probably expose this context
                                          object and then redefine its
                                          methods from Dom scripts.
                                          However, one would lose the
                                          cobweb constructed "with"
                                          "global" object which allows
                                          easy and standard access to
                                          x3d functions and user defined
                                          fields. It could be probably
                                          reconstructed if needed.</p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal">I may try
                                          to convert the example to
                                          cobweb dom.</p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal">Andreas</p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal">-The
                                          formatting survived the direct
                                          mail but not the route through
                                          the list probably because I
                                          receive digests.</p>
                                      </div>
                                      <div>
                                        <p class="MsoNormal"> </p>
                                        <div>
                                          <p class="MsoNormal"> </p>
                                          <div>
                                            <p class="MsoNormal">On Aug
                                              11, 2017 9:03 PM, "Leonard
                                              Daly" <<a
                                                href="mailto:Leonard.Daly@realism.com"
                                                target="_blank"
                                                moz-do-not-send="true">Leonard.Daly@realism.com</a>>
                                              wrote:</p>
                                            <blockquote
                                              style="border-width:medium
                                              medium medium
                                              1pt;border-style:none none
                                              none
                                              solid;border-color:currentcolor
                                              currentcolor currentcolor
rgb(204,204,204);padding:0in 0in 0in
                                              6pt;margin-left:4.8pt;margin-right:0in">
                                              <div>
                                                <div>
                                                  <p class="MsoNormal"
                                                    style="margin-bottom:12pt">I
                                                    was asked by John to
                                                    construct an example
                                                    illustrating the
                                                    items listed below.
                                                    I also have replies
                                                    to Andreas'
                                                    comments. The
                                                    original message is
                                                    at the bottom (for
                                                    reference). I've
                                                    copied the relevant
                                                    questions/statements
                                                    to the top to make
                                                    reading easier.<br>
                                                    <br>
                                                    First to the
                                                    example. It is
                                                    located at <a
href="http://tools.realism.com/development/WG-Support/2017-08-09/ScriptIllustration.html"
                                                      target="_blank"
                                                      moz-do-not-send="true">http://tools.realism.com/<wbr>development/WG-Support/2017-<wbr>08-09/ScriptIllustration.html</a><br>
                                                    It does not use
                                                    Cobweb since I can't
                                                    begin to figure out
                                                    how to do this in
                                                    Cobweb. OTOH, if X3D
                                                    is DOM integrated,
                                                    then the it
                                                    shouldn't matter
                                                    where various
                                                    functions and
                                                    methods are located.<br>
                                                    <br>
                                                    The example is
                                                    strictly 2D, but I
                                                    think it clearly
                                                    illustrates the
                                                    goal. The default Y
                                                    interpolator is
                                                    nothing (no change).
                                                    Selecting different
                                                    buttons change the
                                                    interpolator in
                                                    real-time. Each
                                                    interpolator is
                                                    defined as a
                                                    function. The
                                                    variable 'changeY'
                                                    holds the current
                                                    interpolator. When a
                                                    button is pressed,
                                                    the value of
                                                    'changeY' is set to
                                                    the selected
                                                    interpolator. There
                                                    is no 'case'
                                                    statement the uses
                                                    the correct
                                                    interpolator on each
                                                    pass through the
                                                    animation loop.<br>
                                                    <br>
                                                    John if this doesn't
                                                    illustrate the
                                                    concept, please
                                                    explain what you
                                                    need to see.<br>
                                                    <br>
                                                    Andreas, you have
                                                    done and continue to
                                                    do a lot in support
                                                    of web 3D,
                                                    especially wrt to
                                                    X3DOM. I continue to
                                                    be impressed with
                                                    your solutions to
                                                    problems presented
                                                    to that list. [I'll
                                                    have one soon, with
                                                    a potential
                                                    solution.]<br>
                                                    <br>
                                                  </p>
                                                  <div>
                                                    <p class="MsoNormal"><span
style="color:rgb(51,51,255)">AP: Mixing DOM and x3d scripts is
                                                        inherently
                                                        problematic
                                                        since x3d
                                                        scripts expect
                                                        their own
                                                        environment
                                                        (scope). But
                                                        let's see.</span></p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal"><span
style="color:rgb(51,51,255)"> </span></p>
                                                  </div>
                                                  <p class="MsoNormal"
                                                    style="margin-bottom:12pt"><span
style="color:rgb(51,51,255)">AP: Not sure if x3d scripts should be
                                                      available
                                                      globally, eg. as
                                                      window.foo which
                                                      means foo is
                                                      global. This would
                                                      mean that any
                                                      other script or
                                                      framework needs to
                                                      be careful not to
                                                      use the same
                                                      function names.<br>
                                                      <br>
                                                      AP: window.x3d
                                                      should be nicer,
                                                      as a dedicated
                                                      namespace. x3dom
                                                      uses the x3dom
                                                      namespace.</span><br>
                                                    <br>
                                                    If X3D and HTML are
                                                    fully integrated
                                                    then they will be
                                                    mixed. It is now
                                                    common practice to
                                                    put library methods
                                                    into their own
                                                    namescope. This
                                                    namescope is not
                                                    limited, but is
                                                    prefixed by a known
                                                    library label (e.g.,
                                                    x3dom, THREE, etc.).
                                                    Mandating that X3D
                                                    in HTML use the
                                                    'x3d' namescope
                                                    would cause problems
                                                    if someone wanted to
                                                    run two different
                                                    libraries from the
                                                    same HTML context.
                                                    iframe can fix that,
                                                    but it seems overly
                                                    restrictive.<br>
                                                    <br>
                                                  </p>
                                                  <blockquote
                                                    style="border-width:medium
                                                    medium medium
                                                    1pt;border-style:none
                                                    none none
                                                    solid;border-color:currentcolor
                                                    currentcolor
                                                    currentcolor
                                                    rgb(204,204,204);padding:0in
                                                    0in 0in
                                                    6pt;margin-left:4.8pt;margin-right:0in">
                                                    <p class="MsoNormal"
style="margin-bottom:12pt"><span style="color:rgb(0,153,0)">function
                                                        bar(event, time)
                                                        {<br>
                                                             window.foo
                                                        = bar;         
                                                          // I would
                                                        (perhaps) settle
                                                        for
                                                        window.x3d.foo =
                                                        bar;<br>
                                                        }</span></p>
                                                  </blockquote>
                                                  <div>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                  <p class="MsoNormal"><span
style="color:rgb(51,51,255)">AP: This currently does not work since
                                                      cobweb goes back
                                                      to the original
                                                      function source
                                                      each time the
                                                      script is run. But
                                                      the x3d script
                                                      could probably use
                                                      internally a
                                                      global HTML script
                                                      function which can
                                                      be redefined at
                                                      will, to enable a
                                                      hook into an x3d
                                                      script.</span><br>
                                                    <br>
                                                    [<span
                                                      style="color:rgb(0,153,0)">1]   
                                                    </span></p>
                                                  <blockquote
                                                    style="margin-top:5pt;margin-bottom:5pt">
                                                    <p class="MsoNormal"><span
style="color:rgb(0,153,0)"><Script ...>    <!-- X3D Script node
                                                        --><br>
                                                             function
                                                        foo (event,
                                                        time) {<br>
                                                               
                                                         window.bar =
                                                        foo;<br>
                                                             }<br>
                                                        </script></span></p>
                                                  </blockquote>
                                                  <p class="MsoNormal"><br>
                                                    <span
                                                      style="color:rgb(51,51,255)">AP:
                                                      This probably
                                                      already works
                                                      since cobweb evals
                                                      the function text
                                                      almost as is.</span>
                                                  </p>
                                                  <div>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal"><span
style="color:rgb(51,51,255)">Is this the same as</span></p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal"><br>
                                                      <span
                                                        style="color:rgb(0,153,0)">[2]</span></p>
                                                  </div>
                                                  <blockquote
                                                    style="margin-top:5pt;margin-bottom:5pt">
                                                    <div>
                                                      <p
                                                        class="MsoNormal"><span
style="color:rgb(0,153,0)">var foo = function (event, time) {do_work;};</span></p>
                                                    </div>
                                                    <div>
                                                      <p
                                                        class="MsoNormal"><span
style="color:rgb(0,153,0)">window.bar = foo;</span></p>
                                                    </div>
                                                  </blockquote>
                                                  <div>
                                                    <p class="MsoNormal"><span
style="color:rgb(51,51,255)"> ?</span></p>
                                                  </div>
                                                  <p class="MsoNormal"><br>
                                                    It seems to me that
                                                    eval the script text
                                                    each time,
                                                    especially in an
                                                    animation loop, is
                                                    needlessly
                                                    expensive. <br>
                                                    The two examples
                                                    (indented if that
                                                    works in your mail
                                                    reader) are not the
                                                    same. The first
                                                    example sets
                                                    window.bar to be
                                                    'foo' each time it
                                                    runs. The second
                                                    example only sets
                                                    window.bar to be
                                                    'foo' after the
                                                    definition is
                                                    processed. If there
                                                    is something else
                                                    setting window.bar
                                                    after the 'foo'
                                                    function definition
                                                    is processed, then
                                                    that definition to
                                                    'foo' is never used.<br>
                                                    <br>
                                                    <br>
                                                    <span
                                                      style="color:rgb(51,51,255)">AP:
                                                      What does the SAI
                                                      say about
                                                      manipulating or
                                                      calling x3d script
                                                      functions from the
                                                      outside ? You may
                                                      only be able to
                                                      remove and add
                                                      complete script
                                                      nodes but not work
                                                      with the script
                                                      functions ?</span>
                                                  </p>
                                                  <div>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                  <p class="MsoNormal"><span
style="color:rgb(51,51,255)">AP: Proposed text would be great. For now,
                                                      it may be
                                                      productive to
                                                      settle for
                                                      slightly less
                                                      integration by
                                                      keeping x3d
                                                      scripts pretty
                                                      much internal to
                                                      the x3d context
                                                      but allow x3d
                                                      scene control via
                                                      the DOM, eg. make
                                                      x3d nodes similar
                                                      to svg/html
                                                      elements.</span><br>
                                                    <br>
                                                    <br>
                                                    This is my main
                                                    point. DOM is an
                                                    API. If X3D chooses
                                                    to define an API in
                                                    HTML, then it must
                                                    be done so as not to
                                                    interfere with the
                                                    DOM API. Developers
                                                    will use the DOM API
                                                    to do things anyway.
                                                    X3D should only
                                                    expand on that, not
                                                    restrict that.
                                                    Anything less would
                                                    not be full
                                                    integration. There
                                                    is no such thing as
                                                    an SVG Script tag.
                                                    It is located in the
                                                    same space all all
                                                    HTML scripts.<br>
                                                    <br>
                                                    <br>
                                                    Leonard Daly<br>
                                                    <br>
                                                    P.S. I hope all of
                                                    the formatting and
                                                    styling worked.<br>
                                                    <br>
                                                    <br>
                                                    <br>
                                                    <br>
                                                    <br>
                                                    <br>
                                                    On 8/11/2017 7:33
                                                    AM, Andreas Plesch
                                                    wrote:</p>
                                                </div>
                                                <blockquote
                                                  style="margin-top:5pt;margin-bottom:5pt">
                                                  <div>
                                                    <div>
                                                      <div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal">Date:
                                                          Thu, 10 Aug
                                                          2017 18:31:25
                                                          -0700<br>
                                                          From: Leonard
                                                          Daly <<a
                                                          href="mailto:Leonard.Daly@realism.com"
target="_blank" moz-do-not-send="true">Leonard.Daly@realism.com</a>><br>
                                                          To: John
                                                          Carlson <<a
href="mailto:yottzumm@gmail.com" target="_blank" moz-do-not-send="true">yottzumm@gmail.com</a>>,
                                                          X3D Graphics
                                                          public mailing<br>
                                                                  list
                                                          <<a
                                                          href="mailto:x3d-public@web3d.org"
target="_blank" moz-do-not-send="true">x3d-public@web3d.org</a>>,
                                                          Web3D
                                                          Consortium
                                                          <<a
                                                          href="mailto:consortium@web3d.org"
target="_blank" moz-do-not-send="true">consortium@web3d.org</a>><br>
                                                          Cc: X3D
                                                          Graphics
                                                          Working Group
                                                          <<a
                                                          href="mailto:x3d@web3d.org"
target="_blank" moz-do-not-send="true">x3d@web3d.org</a>><br>
                                                          Subject: Re:
                                                          [x3d-public]
                                                          [x3d] X3D
                                                          Specification
                                                          Relationships<br>
                                                                 
                                                          diagram</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">Leonard,
                                                          thanks for
                                                          raising this,
                                                          and I
                                                          appreciate
                                                          your attempt
                                                          to rally
                                                          broader
                                                          support around
                                                          v4 and web
                                                          compatibility.
                                                          I continue to
                                                          do what I can
                                                          which is not
                                                          too much these
                                                          days.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12pt">On 8/10/2017 5:17 PM, John Carlson wrote:<br>
                                                          ><br>
                                                          > Leonard
                                                          wrote:<br>
                                                          ><br>
                                                          > >and
                                                          node name
                                                          collisions
                                                          (i.e.,
                                                          Script).<br>
                                                          ><br>
                                                          > There has
                                                          been quite a
                                                          bit of
                                                          progress with
                                                          this and
                                                          X3DJSONLD and<br>
                                                          > X3DOM.
                                                          It?s been
                                                          under the
                                                          covers because
                                                          I have not
                                                          advertised it<br>
                                                          > much. I
                                                          have several
                                                          scripts
                                                          running, but
                                                          not the full
                                                          complement of<br>
                                                          > my
                                                          examples.  It
                                                          does not run
                                                          the X3D event
                                                          model yet,
                                                          except for<br>
                                                          >
                                                          initialize().<br>
                                                          ><br>
                                                          > Cobweb of
                                                          course,
                                                          already
                                                          handles this,
                                                          so quit
                                                          bellyaching.<br>
                                                          ><br>
                                                          <br>
                                                          Cobweb even
                                                          with Andreas'
                                                          DOM interface
                                                          extensions
                                                          does not
                                                          integrate<br>
                                                          with the DOM
                                                          regarding
                                                          Scripts. A
                                                          full
                                                          integration
                                                          would allow
                                                          the<br>
                                                          following:</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">Mixing
                                                          DOM and x3d
                                                          scripts is
                                                          inherently
                                                          problematic
                                                          since x3d
                                                          scripts expect
                                                          their own
                                                          environment
                                                          (scope). But
                                                          let's see.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12pt">X3D Script function called 'foo'<br>
                                                          HTML script
                                                          function
                                                          called 'bar'<br>
                                                          <br>
                                                          In the body of
                                                          bar, I should
                                                          be able to
                                                          redefine
                                                          'foo'. It is
                                                          (in a<br>
                                                          fully
                                                          integrated
                                                          system)
                                                          available as
                                                          window.foo.
                                                          Similarly for
                                                          inside<br>
                                                          of 'foo' to
                                                          change 'bar'.</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">Not
                                                          sure if x3d
                                                          scripts should
                                                          be available
                                                          globally, eg.
                                                          as window.foo
                                                          which means
                                                          foo is global.
                                                          This would
                                                          mean that any
                                                          other script
                                                          or framework
                                                          needs to be
                                                          careful not to
                                                          use the same
                                                          function
                                                          names.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12pt">function bar(event, time) {<br>
                                                             
                                                           window.foo =
                                                          bar;         
                                                            // I would
                                                          (perhaps)
                                                          settle for<br>
                                                          window.x3d.foo
                                                          = bar;<br>
                                                          }</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">window.x3d
                                                          should be
                                                          nicer, as a
                                                          dedicated
                                                          namespace.
                                                          x3dom uses the
                                                          x3dom
                                                          namespace.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">This
                                                          currently does
                                                          not work since
                                                          cobweb goes
                                                          back to the
                                                          original
                                                          function
                                                          source each
                                                          time the
                                                          script is run.
                                                          But the x3d
                                                          script could
                                                          probably use
                                                          internally a
                                                          global HTML
                                                          script
                                                          function which
                                                          can be
                                                          redefined at
                                                          will, to
                                                          enable a hook
                                                          into an x3d
                                                          script.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12pt">and<br>
                                                          <br>
                                                          <Script
                                                          ...>   
                                                          <!-- X3D
                                                          Script node
                                                          --><br>
                                                               function
                                                          foo (event,
                                                          time) {<br>
                                                                 
                                                           window.bar =
                                                          foo;<br>
                                                               }<br>
</script></p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">This
                                                          probably
                                                          already works
                                                          since cobweb
                                                          evals the
                                                          function text
                                                          almost as is.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">Is
                                                          this the same
                                                          as</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">var
                                                          foo = function
                                                          (event, time)
                                                          {do_work;};</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">window.bar
                                                          = foo;</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> ?</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12pt">I should be able to construct an object with
                                                          'foo' as a
                                                          method. E.g.,<br>
                                                          <br>
                                                          var globalVar
                                                          = {};<br>
                                                          globalVar.x3d
                                                          = foo;<br>
                                                          <br>
                                                          // should call
                                                          the X3D script
                                                          passing it a
                                                          reference to
                                                          the current<br>
                                                          value of
                                                          'event' and
                                                          'time'.<br>
globalVar.x3d(event, time);</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">It
                                                          may be
                                                          possible to
                                                          'export' named
                                                          x3d script
                                                          functions to
                                                          window.x3d, so
                                                          they can be
                                                          called. cobweb
                                                          would
                                                          currently
                                                          redefine a
                                                          named function
                                                          each time an
                                                          x3d script is
                                                          executed.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"><br>
                                                          Inside 'foo' I
                                                          should be able
                                                          to access any
                                                          DOM element to
                                                          get it's<br>
                                                          current state
                                                          or even
                                                          establish an
                                                          event
                                                          listener.</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">You
                                                          should be able
                                                          to do that in
                                                          cobweb now
                                                          although it
                                                          would be
                                                          strange to
                                                          find DOM code
                                                          in an X3D
                                                          script.
                                                          Perhaps for
                                                          HUD of GUI
                                                          purposes it
                                                          could be
                                                          useful,
                                                          actually.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"><br>
                                                          I know there
                                                          are some
                                                          things that
                                                          Cobweb can do,
                                                          but there has
                                                          been no<br>
                                                          discussions in
                                                          the WG for the
                                                          language that
                                                          would be
                                                          necessary to
                                                          ensure<br>
                                                          HTML/DOM/X3D
                                                          interaction
                                                          like I
                                                          described
                                                          above.</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">What
                                                          does the SAI
                                                          say about
                                                          manipulating
                                                          or calling x3d
                                                          script
                                                          functions from
                                                          the outside ?
                                                          You may only
                                                          be able to
                                                          remove and add
                                                          complete
                                                          script nodes
                                                          but not work
                                                          with the
                                                          script
                                                          functions ?</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"><br>
                                                          Unrolling
                                                          scripts on the
                                                          server (or at
                                                          least not in
                                                          the runtime of
                                                          the<br>
                                                          browser) is
                                                          all fine and
                                                          good, but
                                                          again there
                                                          has been no
                                                          discussion in<br>
                                                          the WG as to
                                                          how to even
                                                          approach
                                                          writing that
                                                          up.<br>
                                                          <br>
                                                          I will be
                                                          happy to be
                                                          (relatively)
                                                          quiet on these
                                                          points if
                                                          someone can<br>
                                                          show me
                                                          working
                                                          examples and
                                                          proposed text
                                                          to make this
                                                          work.</p>
                                                        </blockquote>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">Proposed
                                                          text would be
                                                          great. For
                                                          now, it may be
                                                          productive to
                                                          settle for
                                                          slightly less
                                                          integration by
                                                          keeping x3d
                                                          scripts pretty
                                                          much internal
                                                          to the x3d
                                                          context but
                                                          allow x3d
                                                          scene control
                                                          via the DOM,
                                                          eg. make x3d
                                                          nodes similar
                                                          to svg/html
                                                          elements.</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">-Andreas</p>
                                                        </div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                        </div>
                                                        <blockquote
                                                          style="border-width:medium
                                                          medium medium
1pt;border-style:none none none solid;border-color:currentcolor
                                                          currentcolor
                                                          currentcolor
                                                          rgb(204,204,204);padding:0in
                                                          0in 0in
                                                          6pt;margin-left:4.8pt;margin-right:0in">
                                                          <p
                                                          class="MsoNormal"><br>
                                                          <br>
                                                          --<br>
                                                          *Leonard Daly*<br>
                                                          3D Systems
                                                          & Cloud
                                                          Consultant<br>
                                                          LA ACM
                                                          SIGGRAPH Chair<br>
                                                          President,
                                                          Daly Realism -
                                                          /Creating the
                                                          Future/<br>
                                                          --------------
                                                          next part
                                                          --------------<br>
                                                          An HTML
                                                          attachment was
                                                          scrubbed...<br>
                                                          URL: <<a
href="http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170810/93cc05ca/attachment.html"
target="_blank" moz-do-not-send="true">http://web3d.org/pipermail/<wbr>x3d-public_web3d.org/<wbr>attachments/20170810/93cc05ca/<wbr>attachment.html</a>><br>
                                                          <br>
------------------------------<br>
                                                          <br>
                                                          Subject:
                                                          Digest Footer<br>
                                                          <br>
______________________________<wbr>_________________<br>
                                                          x3d-public
                                                          mailing list<br>
                                                          <a
                                                          href="mailto:x3d-public@web3d.org"
target="_blank" moz-do-not-send="true">x3d-public@web3d.org</a><br>
                                                          <a
                                                          href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org"
target="_blank" moz-do-not-send="true">http://web3d.org/mailman/<wbr>listinfo/x3d-public_web3d.org</a><br>
                                                          <br>
                                                          <br>
------------------------------<br>
                                                          <br>
                                                          End of
                                                          x3d-public
                                                          Digest, Vol
                                                          101, Issue 9<br>
******************************<wbr>************</p>
                                                        </blockquote>
                                                      </div>
                                                      <div>
                                                        <p
                                                          class="MsoNormal"> </p>
                                                      </div>
                                                      <p
                                                        class="MsoNormal"><span
class="gmail-m_524162945316276436gmail-m3040691064007112017m4854531439596135322hoenzb"><span
style="color:rgb(136,136,136)">-- </span></span></p>
                                                      <div>
                                                        <p
                                                          class="MsoNormal"><span
style="color:rgb(136,136,136)">Andreas Plesch<br>
                                                          39 Barbara Rd.<br>
                                                          Waltham, MA
                                                          02453</span></p>
                                                      </div>
                                                    </div>
                                                  </div>
                                                  <p class="MsoNormal"
                                                    style="margin-bottom:12pt"><span
class="gmail-m_524162945316276436gmail-m3040691064007112017m4854531439596135322hoenzb"> </span></p>
                                                  <pre><span style="color:rgb(136,136,136)">______________________________<wbr>_________________</span></pre>
                                                  <pre><span style="color:rgb(136,136,136)">x3d-public mailing list</span></pre>
                                                  <pre><span style="color:rgb(136,136,136)"><a href="mailto:x3d-public@web3d.org" target="_blank" moz-do-not-send="true">x3d-public@web3d.org</a></span></pre>
                                                  <pre><span style="color:rgb(136,136,136)"><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank" moz-do-not-send="true">http://web3d.org/mailman/<wbr>listinfo/x3d-public_web3d.org</a></span></pre>
                                                </blockquote>
                                                <p> </p>
                                                <div>
                                                  <p class="MsoNormal"><span
style="color:rgb(136,136,136)">-- <br>
                                                    </span><b><span
                                                        style="font-size:13.5pt;color:rgb(51,51,102)">Leonard
                                                        Daly</span></b><span
style="color:rgb(51,51,102)"><br>
                                                      3D Systems &
                                                      Cloud Consultant<br>
                                                      LA ACM SIGGRAPH
                                                      Chair<br>
                                                      President, Daly
                                                      Realism - <i>Creating
                                                        the Future</i></span><span
style="color:rgb(136,136,136)"></span></p>
                                                </div>
                                              </div>
                                            </blockquote>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </blockquote>
                                </div>
                                <p class="MsoNormal"><span
                                    style="color:rgb(136,136,136)"><br>
                                    <br clear="all">
                                  </span><span
                                    class="gmail-m_524162945316276436gmail-m3040691064007112017hoenzb"></span></p>
                                <div>
                                  <p class="MsoNormal"> </p>
                                </div>
                                <p class="MsoNormal"><span
                                    class="gmail-m_524162945316276436gmail-m3040691064007112017hoenzb"><span
                                      style="color:rgb(136,136,136)">--
                                    </span></span></p>
                                <div>
                                  <p class="MsoNormal"><span
                                      style="color:rgb(136,136,136)">Andreas
                                      Plesch<br>
                                      39 Barbara Rd.<br>
                                      Waltham, MA 02453</span></p>
                                </div>
                              </div>
                            </blockquote>
                          </div>
                          <p class="MsoNormal"><br>
                            <br clear="all">
                          </p>
                          <div>
                            <p class="MsoNormal"> </p>
                          </div>
                          <p class="MsoNormal">-- </p>
                        </div>
                      </div>
                      <p class="MsoNormal">Andreas Plesch<br>
                        39 Barbara Rd.<br>
                        Waltham, MA 02453</p>
                      <p class="MsoNormal"> </p>
                    </div>
                  </div>
                </blockquote>
              </div>
              <br>
              <br clear="all">
              <br>
              -- <br>
              <div class="gmail_signature">Andreas Plesch<br>
                39 Barbara Rd.<br>
                Waltham, MA 02453</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <div class="moz-signature">-- <br>
      <font class="tahoma,arial,helvetica san serif" color="#333366">
        <font size="+1"><b>Leonard Daly</b></font><br>
        3D Systems & Cloud Consultant<br>
        LA ACM SIGGRAPH Chair<br>
        President, Daly Realism - <i>Creating the Future</i>
      </font></div>
  </body>
</html>