<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Joe,<br>
<br>
</div>
<blockquote type="cite"
cite="mid:7A4D0A9FA5DA4F1A97FB4EF3E6A06F7D@joe1446a4150a8">
<blockquote type="cite">I have not been convinced that Protos need
to exist in an HTML
<br>
</blockquote>
environment.
<br>
<br>
Well, i guess you don't have any example you like that use protos.
I suggest more study.
<br>
</blockquote>
<br>
I asked for examples, there were no responses.<br>
<br>
<br>
<br>
<blockquote type="cite"
cite="mid:7A4D0A9FA5DA4F1A97FB4EF3E6A06F7D@joe1446a4150a8">
<br>
<blockquote type="cite">if you path is to implement Protos on the
way to implementing Scripts,
<br>
you need to solve the entire Script problem first.
<br>
</blockquote>
<br>
Why bother telling someone who is actually doing some work how the
problem must be solmved. Protos don't need scripts to operate yet
can still be very usefull.
<br>
</blockquote>
<br>
Because that problem will still need to be solved. So me (again) an
example of a non-trivial PROTO. Non-trivial means it is not a
convenience short-cut that collects multiple nodes or a node
structure into a single instance. It needs to do something useful
and at least as efficiently as other means for generating the same
result. It needs to be a production usable, not just a development
tool or technique.<br>
<br>
<br>
<br>
<br>
<blockquote type="cite"
cite="mid:7A4D0A9FA5DA4F1A97FB4EF3E6A06F7D@joe1446a4150a8">
<br>
<blockquote type="cite">I think something like a macro expansion
...
<br>
</blockquote>
<br>
well, show your design and we will see if we can help you get it
working.</blockquote>
<br>
I did - almost a year ago. It's online at
<a class="moz-txt-link-freetext" href="http://tools.realism.com/specification/x3d-next-generation/abstract-specification/changes-additions-x3d-v33/macro">http://tools.realism.com/specification/x3d-next-generation/abstract-specification/changes-additions-x3d-v33/macro</a><br>
<br>
<br>
<br>
Leonard Daly<br>
<br>
<br>
<blockquote type="cite"
cite="mid:7A4D0A9FA5DA4F1A97FB4EF3E6A06F7D@joe1446a4150a8">
<br>
<br>
Joe
<br>
<br>
<br>
----- Original Message ----- From: "Leonard Daly"
<a class="moz-txt-link-rfc2396E" href="mailto:Leonard.Daly@realism.com"><Leonard.Daly@realism.com></a>
<br>
To: "John Carlson" <a class="moz-txt-link-rfc2396E" href="mailto:yottzumm@gmail.com"><yottzumm@gmail.com></a>
<br>
Cc: <a class="moz-txt-link-rfc2396E" href="mailto:x3dom-users@lists.sourceforge.net"><x3dom-users@lists.sourceforge.net></a>; "X3D Graphics
public mailing list" <a class="moz-txt-link-rfc2396E" href="mailto:x3d-public@web3d.org"><x3d-public@web3d.org></a>; "Andreas
Plesch" <a class="moz-txt-link-rfc2396E" href="mailto:andreasplesch@gmail.com"><andreasplesch@gmail.com></a>
<br>
Sent: Monday, May 22, 2017 7:06 AM
<br>
Subject: Re: [x3d-public] [x3dom-users] Cobweb_dom...Script Magic?
Loading DOM subscenes after parent in X3DOM and Cobweb. ALMOST
complete, requires sequencing of outer functions.
<br>
<br>
<br>
<blockquote type="cite">John,
<br>
<br>
I have not been convinced that Protos need to exist in an HTML
<br>
environment. Scripts are an integral piece of the Proto
architecture so
<br>
if you path is to implement Protos on the way to implementing
Scripts,
<br>
you need to solve the entire Script problem first. If Scripts
are
<br>
optional, then why have Proto? I think something like a macro
expansion
<br>
can solve all of the use cases where Proto would be used while
being
<br>
lighter weight and easier to implement and possibly use.
<br>
<br>
Leonard Daly
<br>
<br>
<br>
<blockquote type="cite">Leonard, I believe Scripts should be
implemented AFTER Protos. Just
<br>
my opinion. Once the Protos and the ROUTEs and the Scripts
are
<br>
expanded with the new DEFs, then you apply the event model.
This
<br>
makes things easier, but takes more memory. Then you
optimize.
<br>
Beware premature optimization.
<br>
<br>
John
<br>
<br>
On May 21, 2017 12:16 AM, "Leonard Daly"
<<a class="moz-txt-link-abbreviated" href="mailto:Leonard.Daly@realism.com">Leonard.Daly@realism.com</a>
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:Leonard.Daly@realism.com"><mailto:Leonard.Daly@realism.com></a>> wrote:
<br>
<br>
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
<br>
X3D Script node. The integration with HTML is too close to
allow
<br>
an X3D Script node. HTML JavaScript (via DOM and X3D node
<br>
manipulation) is available and used extensively. X3DOM
does not
<br>
handle VRML (meaning a text file with {} syntax). There is
an
<br>
unofficial JSON loader. Perhaps you have one too. How does
it get
<br>
the scene graph into DOM? Does it create DOM elements (or
perhaps
<br>
an HTML text string which is then parsed)? Something else?
<br>
<br>
To the extent I understand your question, you are asking
for help
<br>
in constructing a means of handling X3D Script node in
X3DOM. Once
<br>
that is done, Proto/ExternProto would be next. This would
all come
<br>
into the browser through an JSON encoded file. It seems to
me that
<br>
trying to handle X3D Script code requires an entire
infrastructure
<br>
supporting the X3D event mode and calling script code with
X3D
<br>
arguments. It also requires building full support for SAI
and
<br>
supporting the 'directOutput' field. That is a major
effort with
<br>
no obvious purpose that I see in V4.
<br>
<br>
You are asking for some serious time support (I think)
into an
<br>
application that is neither fully X3D-compliant, nor
DOM-compliant
<br>
(but the closest to both that is available). At least for
me, I do
<br>
not understand how this effort would further an X3D
integrated DOM
<br>
system. I am quite willing to listen to your reasons and
help
<br>
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
<br>
can manipulate things as much as it wants to create
something that
<br>
runs in a client-side browser.
<br>
<br>
P.P.S. I do think there is a need to JSON encoding in V4
subject
<br>
to the node definition for V4.
<br>
<br>
<br>
<br>
<blockquote type="cite"> Yes, Leonard, for quite some time
I have an X3D JSON
<br>
PROTOtypeExpander.js that works with X3D PROTOs and
EXTERNPROTOs
<br>
and displays in X3DOM. I don’t know how complete it is,
and
<br>
testers are welcome. My EXTERNPROTO expander runs on the
server,
<br>
so is not included in the message, but it is included in
the link
<br>
in the original message. If someone can make the
EXTERNPROTO
<br>
expander work client side that would be great.
<br>
<br>
The EXTERNPROTO expander is generally called like:
<br>
<br>
json = externPrototypeExpander(outfile,
json);
<br>
<br>
Where json is the parent json of the extern, and outfile
is the
<br>
parent X3D file being loaded (I think “” will probably
do in a
<br>
pinch. I am not sure.). The extern PROTOs will be
included in
<br>
the original JSON as a ProtoDeclare object. You may
have to run
<br>
the flattener afterwards, and it is run as:
<br>
<br>
json = flattener(json);
<br>
<br>
It removes empty objects from the JSON.
<br>
<br>
Yes, I would like someone to help me with VRMLScript for
X3DOM,
<br>
if someone is available. I have a very barebones and
incorrect
<br>
implementation here:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js></a>
<br>
<br>
Please help. I don’t know the X3D event model, and I’m
not
<br>
likely to learn soon. The X3D event model can be
emulated in
<br>
Browser-side JavaScript, but there’s only Cobweb for
proof.
<br>
<br>
<br>
I have another version of flipper.html here that works
with X3DOM
<br>
and Cobweb adding the subscene later. It works with
Promises,
<br>
but the functions still aren’t separated…close, but no
cigar.
<br>
Take a look:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html></a>
<br>
<br>
Sorry, I tend to use the XML version of “Proto”, and not
the VRML
<br>
“PROTO”.
<br>
<br>
X3DJSONLD provides an infrastructure for X3D JSON
Browser
<br>
development, including X3D XML -> X3D JSON conversion
on the
<br>
server, and X3D JSON to X3D XML loading into X3DOM and
Cobweb.
<br>
It also includes conversions from XML DOM to Java and
Nashorn
<br>
JavaScript for X3DJSAIL app development.
<br>
<br>
There is definite potential for an XML PROTO expander,
as I have
<br>
written this code, but not seriously tested:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/CompleteXMLPrototypeExpander.js></a>
<br>
<br>
So far, it’s still server-side. If you’re going to
modify it,
<br>
split it into server and client-side pieces, please.
Complete is
<br>
probably a misnomer…
<br>
<br>
Thanks,
<br>
<br>
John
<br>
<br>
Sent from Mail
<a class="moz-txt-link-rfc2396E" href="https://go.microsoft.com/fwlink/?LinkId=550986"><https://go.microsoft.com/fwlink/?LinkId=550986></a>
<br>
for Windows 10
<br>
<br>
*From: *Leonard Daly
<a class="moz-txt-link-rfc2396E" href="mailto:Leonard.Daly@realism.com"><mailto:Leonard.Daly@realism.com></a>
<br>
*Sent: *Saturday, May 20, 2017 7:17 PM
<br>
*To: *John Carlson <a class="moz-txt-link-rfc2396E" href="mailto:yottzumm@gmail.com"><mailto:yottzumm@gmail.com></a>;
Andreas Plesch
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:andreasplesch@gmail.com"><mailto:andreasplesch@gmail.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:holger.seelig@yahoo.de">holger.seelig@yahoo.de</a>
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:holger.seelig@yahoo.de"><mailto:holger.seelig@yahoo.de></a>
<br>
*Cc: *x3dom-users@lists.sourceforge.net
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:x3dom-users@lists.sourceforge.net"><mailto:x3dom-users@lists.sourceforge.net></a>; X3D
Graphics public
<br>
mailing list <a class="moz-txt-link-rfc2396E" href="mailto:x3d-public@web3d.org"><mailto:x3d-public@web3d.org></a>
<br>
*Subject: *Re: [x3dom-users] Cobweb_dom...Script Magic?
Loading
<br>
DOM subscenesafter parent in X3DOM and Cobweb.
<br>
<br>
John,
<br>
<br>
Cobweb_dom, X3DOM experts, I need some help adding a
child
<br>
DOM scenegraph with prototypes to a parent DOM
scenegraph
<br>
after the
<br>
<br>
<br>
Not sure how any of this applies to X3DOM as it does not
have
<br>
PROTOs. Assuming you mean X3D prototypes via PROTO or
<br>
EXTERNPROTO. If you mean something else, please
elaborate.
<br>
<br>
<br>
Leonard Daly
<br>
<br>
<br>
<br>
<br>
primary scene has been loaded, and not before. I
have an
<br>
example of loading before the scene is loaded, and
in a
<br>
callback. If you have an example with Promises
instead of
<br>
callback nesting, that would be more ideal, the
second
<br>
$.getJSON() (child scenegraph) might finish before
the first
<br>
$.getJSON() (parent scenegraph) if I don’t use
promises or
<br>
callback nesting. Also, Promises would allow me to
separate
<br>
the parent loading somewhat from the child loading,
and
<br>
create separate functions. Also, X3DOM experts can
provide
<br>
an example with Promises as well. Meanwhile, I will
be
<br>
reading about Promises.
<br>
<br>
Here is my example so far:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/html/flipper.html></a>
<br>
<br>
Viewable here:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html">https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html"><https://coderextreme.net/X3DJSONLD/src/main/html/flipper.html></a>
<br>
<br>
The white Box is the subscene of the dolphin scene.
<br>
<br>
The following related code is from
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/loaderJQuery.js></a>
<br>
<br>
and references code from:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/X3DJSONLD.js></a>
<br>
<br>
[ actually, I think the last two reference each
other – naughty ]
<br>
<br>
Data is here:
<br>
<br>
[ child scenegraph ]
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/abox.json></a>
<br>
<br>
[ parent scenegraph ]
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/flipp.json></a>
<br>
<br>
Cobweb doesn’t need the prototypeExpander or the
flattener
<br>
(well, it might have with prototypes in cobweb_dom,
but I
<br>
think the last release fixed that…haven’t
checked—here is a
<br>
good test for you!). This is a dual example, and I
haven’t
<br>
figured out how to conditionally run the
prototypeExpander on
<br>
only X3DOM code. Please test without the
<br>
PrototypeExpander.js and Flattener.js included, and
remove
<br>
X3DOM, since it won’t work in that case. X3DOM
folks can
<br>
include the two JavaScript files which are here:
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PrototypeExpander.js></a>
<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js</a>
<br>
<br>
<a class="moz-txt-link-rfc2396E" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js"><https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Flattener.js></a>
<br>
<br>
You may provide your own appendInline (below) which
doesn’t
<br>
call loadSchema. That may be too complex of a
download.
<br>
That is, you probably don’t want to do all that JSON
schema
<br>
validation in your example. Try to keep my code
close to
<br>
what it is otherwise.
<br>
<br>
And if you start supporting X3D JSON in your
viewers, that
<br>
would be even better!
<br>
<br>
John
<br>
<br>
/**
<br>
<br>
·Next is passed the element parameter
<br>
<br>
·*/
<br>
<br>
function appendInline(element, url, next) {
<br>
<br>
$.getJSON(url, function(json) {
<br>
<br>
if (typeof prototypeExpander === 'function') {
<br>
<br>
json = prototypeExpander(url, json, "");
<br>
<br>
} else {
<br>
<br>
console.error("Perhaps you need to include the
<br>
PrototypeExpander.js?");
<br>
<br>
}
<br>
<br>
if (typeof flattener === 'function') {
<br>
<br>
json = flattener(json);
<br>
<br>
} else {
<br>
<br>
console.error("Perhaps you need to include the
Flattener.js?");
<br>
<br>
}
<br>
<br>
// must validate here because we call an inner
method.
<br>
<br>
loadSchema(json, url, doValidate, function() {
<br>
<br>
ConvertToX3DOM(json["X3D"]["Scene"], "Scene",
element, url);
<br>
<br>
next(element);
<br>
<br>
}, function(e) {
<br>
<br>
console.error(e);
<br>
<br>
});
<br>
<br>
}).fail(function(jqXHR, textStatus, errorThrown) {
<br>
alert('getJSON request failed! ' + textStatus + ' '
+
<br>
errorThrown); });
<br>
<br>
}
<br>
<br>
/**
<br>
<br>
·Next is passed the selected element from selector
<br>
<br>
·Selector is the CSS selector to append inline to.
<br>
<br>
·*/
<br>
<br>
function loadSubscene(selector, url, next) {
<br>
<br>
appendInline(document.querySelector(selector), url,
next);
<br>
<br>
}
<br>
<br>
<br>
<br>
<br>
------------------------------------------------------------------------------<br>
<br>
Check out the vibrant tech community on one of the
world's most
<br>
<br>
engaging tech sites,
Slashdot.org!<a class="moz-txt-link-freetext" href="http://sdm.link/slashdot">http://sdm.link/slashdot</a>
<br>
<br>
<br>
<br>
<br>
_______________________________________________
<br>
<br>
X3dom-users mailing list
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:X3dom-users@lists.sourceforge.net">X3dom-users@lists.sourceforge.net</a>
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:X3dom-users@lists.sourceforge.net"><mailto:X3dom-users@lists.sourceforge.net></a>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/x3dom-users">https://lists.sourceforge.net/lists/listinfo/x3dom-users</a>
<br>
<a class="moz-txt-link-rfc2396E" href="https://lists.sourceforge.net/lists/listinfo/x3dom-users"><https://lists.sourceforge.net/lists/listinfo/x3dom-users></a>
<br>
<br>
-- *Leonard Daly*
<br>
3D Systems & Cloud Consultant
<br>
LA ACM SIGGRAPH Chair
<br>
President, Daly Realism - /Creating the Future/
<br>
<br>
</blockquote>
<br>
-- *Leonard Daly*
<br>
3D Systems & Cloud Consultant
<br>
LA ACM SIGGRAPH Chair
<br>
President, Daly Realism - /Creating the Future/
<br>
<br>
</blockquote>
<br>
-- <br>
*Leonard Daly*
<br>
3D Systems & Cloud Consultant
<br>
LA ACM SIGGRAPH Chair
<br>
President, Daly Realism - /Creating the Future/
<br>
<br>
</blockquote>
<br>
<br>
--------------------------------------------------------------------------------
<br>
<br>
<br>
<blockquote type="cite">_______________________________________________
<br>
x3d-public mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a>
<br>
<br>
</blockquote>
<br>
<br>
------------------------------------------------------------------------------
<br>
Check out the vibrant tech community on one of the world's most
<br>
engaging tech sites, Slashdot.org! <a class="moz-txt-link-freetext" href="http://sdm.link/slashdot">http://sdm.link/slashdot</a>
<br>
_______________________________________________
<br>
X3dom-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:X3dom-users@lists.sourceforge.net">X3dom-users@lists.sourceforge.net</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/x3dom-users">https://lists.sourceforge.net/lists/listinfo/x3dom-users</a>
<br>
</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>