<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">John,<br>
<br>
I have not been convinced that Protos need to exist in an HTML
environment. Scripts are an integral piece of the Proto
architecture so if you path is to implement Protos on the way to
implementing Scripts, you need to solve the entire Script problem
first. If Scripts are optional, then why have Proto? I think
something like a macro expansion can solve all of the use cases
where Proto would be used while being lighter weight and easier to
implement and possibly use.<br>
<br>
Leonard Daly<br>
<br>
<br>
</div>
<blockquote type="cite"
cite="mid:CAGC3UE=Gbujm8Vhb8C4MpHf9Dt_7nT4i3S0bjESsSnFRC9ZdYg@mail.gmail.com">
<div dir="auto">Leonard, I believe Scripts should be implemented
AFTER Protos.  Just my opinion. Once the Protos and the ROUTEs
and the Scripts are expanded with the new DEFs, then you apply
the event model. Â This makes things easier, but takes more
memory. Â Then you optimize. Â Beware premature optimization.
<div dir="auto"><br>
</div>
<div dir="auto">John</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On May 21, 2017 12:16 AM, "Leonard
Daly" <<a href="mailto:Leonard.Daly@realism.com"
moz-do-not-send="true">Leonard.Daly@realism.com</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_7357056672881959298moz-cite-prefix">John,<br>
<br>
I don't really like to answer this way, but why?<br>
<br>
X3DOM does not have Proto/ExternProto feature. It does
not have X3D Script node. The integration with HTML is
too close to allow an X3D Script node. HTML JavaScript
(via DOM and X3D node manipulation) is available and
used extensively. X3DOM does not handle VRML (meaning a
text file with {} syntax). There is an unofficial JSON
loader. Perhaps you have one too. How does it get the
scene graph into DOM? Does it create DOM elements (or
perhaps an HTML text string which is then parsed)?
Something else?<br>
<br>
To the extent I understand your question, you are asking
for help in constructing a means of handling X3D Script
node in X3DOM. Once that is done, Proto/ExternProto
would be next. This would all come into the browser
through an JSON encoded file. It seems to me that trying
to handle X3D Script code requires an entire
infrastructure supporting the X3D event mode and calling
script code with X3D arguments. It also requires
building full support for SAI and supporting the
'directOutput' field. That is a major effort with no
obvious purpose that I see in V4.<br>
<br>
You are asking for some serious time support (I think)
into an application that is neither fully X3D-compliant,
nor DOM-compliant (but the closest to both that is
available). At least for me, I do not understand how
this effort would further an X3D integrated DOM system.
I am quite willing to listen to your reasons and help
where I can, but I would like to see where this is going
first.<br>
<br>
Leonard Daly<br>
<br>
P.S. Everything above is for client-side code. Server
side code can manipulate things as much as it wants to
create something that runs in a client-side browser.<br>
<br>
P.P.S. I do think there is a need to JSON encoding in V4
subject to the node definition for V4.<br>
<br>
<br>
<br>
</div>
<blockquote type="cite">
<div class="m_7357056672881959298WordSection1">
<p class="MsoNormal">Yes, Leonard, for quite some time
I have an X3D JSON PROTOtypeExpander.js that works
with X3D PROTOs and EXTERNPROTOs and displays in
X3DOM. I don’t know how complete it is, and testers
are welcome. My EXTERNPROTO expander runs on the
server, so is not included in the message, but it is
included in the link in the original message. If
someone can make the EXTERNPROTO expander work
client side that would be great.</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">The EXTERNPROTO expander is
generally called like:</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â json =
externPrototypeExpander(<wbr>outfile, json);</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">Where json is the parent json of
the extern, and outfile is the parent X3D file being
loaded (I think “†will probably do in a pinch. I
am not sure.). The extern PROTOs will be included
in the original JSON as a ProtoDeclare object. You
may have to run the flattener afterwards, and it is
run as:</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal"><span style="font-size:14.0pt">Â Â Â Â Â Â Â Â Â Â Â
<span style="color:black">json = flattener(json);</span></span></p>
<p class="MsoNormal"><span
style="font-size:14.0pt;color:black">Â </span></p>
<p class="MsoNormal">It removes empty objects from the
JSON.</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">Yes, I would like someone to help
me with VRMLScript for X3DOM, if someone is
available. I have a very barebones and incorrect
implementation here:</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/Script.js</a></p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">Please help. I don’t know the
X3D event model, and I’m not likely to learn soon.Â
The X3D event model can be emulated in Browser-side
JavaScript, but there’s only Cobweb for proof.</p>
<p class="MsoNormal"><br>
I have another version of flipper.html here that
works with X3DOM and Cobweb adding the subscene
later. It works with Promises, but the functions
still aren’t separated…close, but no cigar. Take a
look:</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/html/flipper.<wbr>html</a></p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">Sorry, I tend to use the XML
version of “Protoâ€, and not the VRML “PROTOâ€.</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">X3DJSONLD provides an
infrastructure for X3D JSON Browser development,
including X3D XML -> X3D JSON conversion on the
server, and X3D JSON to X3D XML loading into X3DOM
and Cobweb. It also includes conversions from XML
DOM to Java and Nashorn JavaScript for X3DJSAIL app
development.</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">There is definite potential for
an XML PROTO expander, as I have written this code,
but not seriously tested:</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>CompleteXMLPrototypeExpander.<wbr>js</a></p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">So far, it’s still server-side.Â
If you’re going to modify it, split it into server
and client-side pieces, please. Complete is
probably a misnomer…</p>
<p class="MsoNormal">Â </p>
<p class="MsoNormal">Thanks,</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:none;border-top:solid #e1e1e1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From:
</b><a href="mailto:Leonard.Daly@realism.com"
target="_blank" moz-do-not-send="true">Leonard
Daly</a><br>
<b>Sent: </b>Saturday, May 20, 2017 7:17 PM<br>
<b>To: </b><a href="mailto:yottzumm@gmail.com"
target="_blank" moz-do-not-send="true">John
Carlson</a>; <a
href="mailto:andreasplesch@gmail.com"
target="_blank" moz-do-not-send="true">Andreas
Plesch</a>; <a
href="mailto:holger.seelig@yahoo.de"
target="_blank" moz-do-not-send="true">holger.seelig@yahoo.de</a><br>
<b>Cc: </b><a
href="mailto:x3dom-users@lists.sourceforge.net"
target="_blank" moz-do-not-send="true">x3dom-users@lists.sourceforge.<wbr>net</a>;
<a href="mailto:x3d-public@web3d.org"
target="_blank" moz-do-not-send="true">X3D
Graphics public mailing list</a><br>
<b>Subject: </b>Re: [x3dom-users]
Cobweb_dom...Script Magic? Loading DOM
subscenesafter parent in X3DOM and Cobweb.</p>
</div>
<p class="MsoNormal">Â </p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="color:black">John,</span></p>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Cobweb_dom,
X3DOM experts, I need some help adding a child
DOM scenegraph with prototypes to a parent DOM
scenegraph after the </span></p>
</blockquote>
<p class="MsoNormal"><span style="color:black"><br>
Not sure how any of this applies to X3DOM as it
does not have PROTOs. Assuming you mean X3D
prototypes via PROTO or EXTERNPROTO. If you mean
something else, please elaborate.<br>
<br>
<br>
Leonard Daly<br>
<br>
<br>
<br>
<br>
</span></p>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">primary
scene has been loaded, and not before. I have
an example of loading before the scene is
loaded, and in a callback. If you have an
example with Promises instead of callback
nesting, that would be more ideal, the second
$.getJSON() (child scenegraph) might finish
before the first $.getJSON() (parent scenegraph)
if I don’t use promises or callback nesting.
Also, Promises would allow me to separate the
parent loading somewhat from the child loading,
and create separate functions. Also, X3DOM
experts can provide an example with Promises as
well. Meanwhile, I will be reading about
Promises.</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">Here
is my example so far:</span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/html/flipper.<wbr>html</a><br>
<br>
Viewable here:</span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html"
target="_blank" moz-do-not-send="true">https://coderextreme.net/<wbr>X3DJSONLD/src/main/html/<wbr>flipper.html</a></span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">The
white Box is the subscene of the dolphin scene.</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">The
following related code is from <a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>loaderJQuery.js</a></span></p>
<p class="MsoNormal"><span style="color:black">and
references code from:</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>X3DJSONLD.js</a></span></p>
<p class="MsoNormal"><span style="color:black">[
actually, I think the last two reference each
other – naughty ]</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">Data
is here:</span></p>
<p class="MsoNormal"><span style="color:black">[
child scenegraph ]</span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/data/abox.json</a></span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">[
parent scenegraph ]</span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/data/flipp.<wbr>json</a></span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">Cobweb
doesn’t need the prototypeExpander or the
flattener (well, it might have with prototypes
in cobweb_dom, but I think the last release
fixed that…haven’t checked—here is a good test
for you!). This is a dual example, and I
haven’t figured out how to conditionally run the
prototypeExpander on only X3DOM code. Please
test without the PrototypeExpander.js and
Flattener.js included, and remove X3DOM, since
it won’t work in that case. X3DOM folks can
include the two JavaScript files which are here:</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>PrototypeExpander.js</a></span></p>
<p class="MsoNormal"><span style="color:black"><a
href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>coderextreme/X3DJSONLD/blob/<wbr>master/src/main/node/<wbr>Flattener.js</a></span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">You
may provide your own appendInline (below) which
doesn’t call loadSchema. That may be too
complex of a download. That is, you probably
don’t want to do all that JSON schema validation
in your example. Try to keep my code close to
what it is otherwise.</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">And
if you start supporting X3D JSON in your
viewers, that would be even better!</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">John</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">/**</span></p>
<p class="m_7357056672881959298MsoNormalCxSpMiddle"
style="margin-left:56.25pt;line-height:105%"><span
style="font-family:Symbol;color:black"><span>·<span
style="font:7.0pt "Times New
Roman"">Â Â Â Â Â Â Â Â </span></span></span><span
style="color:black">Next is passed the element
parameter</span></p>
<p class="m_7357056672881959298MsoNormalCxSpMiddle"
style="margin-left:56.25pt;line-height:105%"><span
style="font-family:Symbol;color:black"><span>·<span
style="font:7.0pt "Times New
Roman"">Â Â Â Â Â Â Â Â </span></span></span><span
style="color:black">*/</span></p>
<p class="MsoNormal"><span style="color:black">function
appendInline(element, url, next) {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â
$.getJSON(url, function(json) {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
if (typeof prototypeExpander === 'function') {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
json = prototypeExpander(url, json, "");</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
} else {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
console.error("Perhaps you need to include the
PrototypeExpander.js?");</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â
         }</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
if (typeof flattener === 'function') {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
json = flattener(json);</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
} else {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
console.error("Perhaps you need to include the
Flattener.js?");</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
}</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â
     // must validate here because we call an
inner method.</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
loadSchema(json, url, doValidate, function() {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
ConvertToX3DOM(json["X3D"]["<wbr>Scene"],
"Scene", element, url);</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
next(element);</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â
       }, function(e) {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
console.error(e);</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
});</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â
}).fail(function(jqXHR, textStatus, errorThrown)
{ alert('getJSON request failed! ' + textStatus
+ ' ' + errorThrown); });</span></p>
<p class="MsoNormal"><span style="color:black">}</span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
<p class="MsoNormal"><span style="color:black">/**</span></p>
<p class="m_7357056672881959298MsoNormalCxSpMiddle"
style="margin-left:1.0in;line-height:105%"><span
style="font-family:Symbol;color:black"><span>·<span
style="font:7.0pt "Times New
Roman"">Â Â Â Â Â Â Â Â </span></span></span><span
style="color:black">Next is passed the selected
element from selector</span></p>
<p class="m_7357056672881959298MsoNormalCxSpMiddle"
style="margin-left:1.0in;line-height:105%"><span
style="font-family:Symbol;color:black"><span>·<span
style="font:7.0pt "Times New
Roman"">Â Â Â Â Â Â Â Â </span></span></span><span
style="color:black">Selector is the CSS selector
to append inline to.</span></p>
<p class="m_7357056672881959298MsoNormalCxSpMiddle"
style="margin-left:1.0in;line-height:105%"><span
style="font-family:Symbol;color:black"><span>·<span
style="font:7.0pt "Times New
Roman"">Â Â Â Â Â Â Â Â </span></span></span><span
style="color:black">*/</span></p>
<p class="MsoNormal"><span style="color:black">function
loadSubscene(selector, url, next) {</span></p>
<p class="MsoNormal"><span style="color:black">Â Â Â Â Â Â Â
appendInline(document.<wbr>querySelector(selector),
url, next);</span></p>
<p class="MsoNormal"><span style="color:black">}</span></p>
<p class="MsoNormal"><span style="color:black"><br>
<br>
<br>
</span></p>
<pre>------------------------------<wbr>------------------------------<wbr>------------------</pre>
<pre>Check out the vibrant tech community on one of the world's most</pre>
<pre>engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" target="_blank" moz-do-not-send="true">http://sdm.link/slashdot</a></pre>
<p class="MsoNormal"><span style="color:black"><br>
<br>
<br>
</span></p>
<pre>______________________________<wbr>_________________</pre>
<pre>X3dom-users mailing list</pre>
<pre><a href="mailto:X3dom-users@lists.sourceforge.net" target="_blank" moz-do-not-send="true">X3dom-users@lists.sourceforge.<wbr>net</a></pre>
<pre><a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users" target="_blank" moz-do-not-send="true">https://lists.sourceforge.net/<wbr>lists/listinfo/x3dom-users</a></pre>
</blockquote>
<p>Â </p>
<p class="MsoNormal"><span style="color:black">-- <br>
</span><b><span
style="font-size:13.5pt;color:#333366">Leonard
Daly</span></b><span style="color:#333366"><br>
3D Systems & Cloud Consultant<br>
LA ACM SIGGRAPH Chair<br>
President, Daly Realism - <i>Creating the Future</i>
</span><span style="color:black"></span></p>
<p class="MsoNormal"><span style="color:black">Â </span></p>
</div>
</blockquote>
<p><br>
</p>
<div class="m_7357056672881959298moz-signature">-- <br>
<font class="m_7357056672881959298tahoma,arial,helvetica
m_7357056672881959298san m_7357056672881959298serif"
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>
</div>
</blockquote>
</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>