[x3d-public] [x3dom-developers] Prototype

Don Brutzman brutzman at nps.edu
Mon Feb 16 11:19:43 PST 2015


First, congratulations X3DOM developers.  Getting to embedded Script nodes inside of Prototype declarations is about the most sophisticated thing that there is in X3D.  Indeed it is a major language feature for Extensibility (the X in X3D).  So if we get that working in X3DOM, everything else is easier.   8)

Attached please find a recently drawn diagram that sheds some light on when values of embedded Script fields get initialized or overridden, and also when they don't.  Perhaps some folks will find it helpful.  Comments and improvements welcome, I'll be cleaning it up and adding an electronic version to the other prototype resources.

I'm pretty sure that Xj3D satisfactorily supports everything (ProtoInstance fieldValue ExternProtoDeclare ProtoDeclare Script field IS connect).  We recently improved some of the console diagnostics there, which has helped in scene debugging.  If problems are still encountered, then they are typically elsewhere in the scene graph.  Running open-source Xj3D within Netbeans in debug mode lets us drill down to any line of code necessary.

I've noticed that InstantReality sometimes gives "false positive" warnings, such as when no value is provided for a field that is allowed to be empty (MF arrays for example).  I'll watch for those in the future and submit bug reports when encountered.  Always a good idea to clear up warnings so that actual problems don't lurk beneath them.

Just performed a search on the X3D Example Archives and found <ProtoDeclare name="something"/> 1305 times in 319 files.  So they are used.  Working too, since we fix bugs each time we find them.  Not sure that I know of any offhand that are currently not working.
http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples

A really big boost is that the tool suite making up the X3D Validator finds problems in content.  So far it detects and reports each possible pathology I've detected in (ProtoInstance fieldValue ExternProtoDeclare ProtoDeclare Script field IS connect) constructs... with one exception: what about if field definitions in an ExternProtoDeclare don't match the original ProtoDeclare?

If anyone has any X3D test-case example scene that doesn't seem to work, please post it.  If there is a hole in the test suite I'll reply "thank you very much!" and add another X3D Validator warning to cover it.  If there is indeed a hole in the X3D specification then several people will say "thank you very much!" and we'll fix that.

X3D-Edit handles that case for authors, providing a button to (1) test and (2) correct for mismatched ExternProtoDeclare field signatures.

Our routine for checking scenes is to test prototype operation in BS Contact, Instant Reality, OctagaVS and Xj3D.  So working across players isn't itself a problem.

So implementing this proven, standard, working capability would seem to be worthwhile.  Certainly seems easier than creating a new nonstandard extension mechanism that doesn't support X3D content.

I seem to recall a few years of sturm and drang that thundered why X3D events and ROUTEs and interpolators could never coexist within DOM.  Uh, all implemented now.  Maybe a dozen years ago the notion of X3D working in a DOM was given the approximate stature of matter versus antimatter.  Uh, all implemented now.

And of course nowadays there are many great young programmers, undistracted by old-timer opinions about impossibility, who can Make Things Just Work.  8)

"You can run but maybe can't hide" department:  we could also write an XSLT converter that takes ProtoInstances and simply performs brute-force conversion into a regular, more verbose, non-prototyped X3D scene graph.  (Uh, this is essentially what a browser does anyway.)  So that could provide support for non-proto-capable X3D players.  Haven't done that to date, but certainly it is straightforward to build such a converter.  Simple Matter Of Programming (SMOP).  Seems kinda wasteful to create all of that duplicative content, but it is yet another option - perhaps as a preprocessor to X3DOM or other players who want a quick fix.

Stepping stone: might be simpler to first implement X3DOM prototypes without Script/IS/connect.  Art Deco Materials, for instance.

Safety net:  the Fraunhofer team has always done an outstanding job of cleaning up code contributions to X3DOM (witness CAD, H-Anim, and many other components).

Take away:  all do-able, and all test content validatable.

This would seem to be a matter of when, not if.

So, who will add the initial implementation of prototypes to open-source X3DOM?



On 2/16/2015 9:13 AM, Don Brutzman wrote:
> It would be good to discuss strategies for eventually implementing X3D prototypes.
>
> Lots of X3D players have implemented prototypes, so they are a well-proven technology.
>
> Other opportunities for implementation in X3DOM may emerge. For example, if there is a design pattern for mapping an X3D ProtoDeclare into X3DOM source code, then we could write an XSLT stylesheet to provide such a conversion on demand.
>
> Sounds less efficient than simply implementing prototypes in X3DOM, but it is a path.
>
> Incidentally, in case anyone had a mistaken impression, there are no "native XML tags" for prototypes in the .x3d syntax.  Example invocation:
>
>       <ProtoInstance name='TimeDelaySensor' DEF='TimeDelaySensorExample'>
>         <fieldValue name='description' value='double click to initiate time-delayed event'/>
>         <fieldValue name='delayInterval' value='1'/>
>       </ProtoInstance>
>
> Similar syntax using the @name attribute is provided for ProtoDeclare and ExternProtoDeclare.  References:
>
> http://www.web3d.org/x3d/content/X3dTooltips.html#ProtoInstance
> http://www.web3d.org/x3d/content/X3dTooltips.html#ProtoDeclare
> http://www.web3d.org/x3d/content/X3dTooltips.html#ExternProtoDeclare
>
> http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14-Prototypes
> http://x3dgraphics.com/slidesets/X3dForWebAuthors/Chapter14-Prototypes.pdf
> https://www.movesinstitute.org/Video/Courses/X3dForWebAuthors/X3dForWebAuthorsVideo.html#14
>
> all the best, Don
>


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: X3dProtoScriptDiagram.pdf
Type: application/pdf
Size: 47803 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20150216/6f6aabf2/attachment-0001.pdf>


More information about the x3d-public mailing list