[x3d-public] Script node implementation questions

Don Brutzman brutzman at nps.edu
Sat Aug 15 09:38:11 PDT 2020


Thanks for your continuing efforts.  Tricky business, but... we only have to get it right once and then it works for everyone.  Plus multiple open-source implementations exist.

On 8/14/2020 6:12 PM, John Carlson wrote:
> 
> Is there an IS (International Standard), as opposed to a CD (Committee Draft?)?

On the Web3D Consortium's Recommended Standards page, a legend table appears at the bottom that explains the acronyms:

[1] Recommended Standards
     https://www.web3d.org/standards

CD	Committee Draft
	First vote with technical comments on proposed standard or revision.
DIS	(was FCD) Draft International Standard (was Final Committee Draft)
	Last vote with technical comments on proposed standard or revision.
FDIS	Final Draft International Standard
	Last ISO vote on proposed standard or revision. This is a Yes/No vote only.
IS	International Standard
	Approved and published standard or revision.

Then listed above, row by row, are entries for each recommended standard.  Of interest here:

19777-1	ISO/IEC CD 19777-1:201x
	V3.3
	X3D Language Bindings : ECMAScript (JavaScript)
	CD 2014-09-05
	HTML https://www.web3d.org/documents/specifications/19777-1/V3.3/index.html
	ZIP  https://www.web3d.org/documents/specifications/19777-1/V3.3/ISO-IEC-19777-1-CD-V3.3.zip

> I was guessing once I got field support working, that events would be automatic? Not really sure...  I guess I'll have to do the set_, _changed stuff, but I'm not really sure.  Maybe I should do initializing in the initialize() method?

Guessing is not possible, unless you have language-algorithm ESP maybe...  Reading the specification is how to be sure.

In scripts, the initialize() method is automatically called first, and the shutdown() method is automatically called last.

Three ! specifications describe functionality: X3D Architecture, X3D Scene Access Interface, and the Ecmascript language binding.

Recommend reading them, key sections follow.

[2.1] X3D Abstract : Node Definitions, with formal title
       X3D Part 1: Architecture and base components

	4.4.2.2 Field semantics
	https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#FieldSemantics

	4.4.2.4 Modifying objects
	https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#Modifyingobjects

	4.4.8 Event model
	https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#Eventmodel

	29.2 Scripting component, concepts
	https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/scripting.html#Concepts

[2.2] 19775-2 X3D Abstract : Scene Access Interface (SAI), with formal title
       19775-2 X3D Part 2: Scene access interface (SAI)
       https://www.web3d.org/documents/specifications/19775-2/V3.3/Part02/X3D_SAI.html

	4.4.8 Node and node lifecycle
	https://www.web3d.org/documents/specifications/19775-2/V3.3/Part02/concepts.html#Node

	4.4.9 Field
	https://www.web3d.org/documents/specifications/19775-2/V3.3/Part02/concepts.html#Field

[2.3] X3D language bindings, Part 1: ECMAScript
       https://www.web3d.org/documents/specifications/19777-1/V3.3/index.html

	5.2.11 Script content services
	https://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/tables.html#ScriptServices

Whew, that is a lot.  All together now, presented in different ways (examples, book, slides, videos):

[3.1] X3D Example Archives: X3D for Web Authors, Chapter 09 Event Utilities Scripting
       https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting

[3.2] X3D For Web Authors, Chapter 9, Event Utilities and Scripting
       http://x3dgraphics.com

[3.3] Chapter 9, Event Utilities and Scripting, slideset
       http://x3dgraphics.com/slidesets/X3dForWebAuthors/Chapter09EventUtilitiesScripting.pdf

[3.4] YouTube course videos: Chapter 9, Event Utilities and Scripting
       https://www.youtube.com/playlist?list=PLuSIsM-86sik26mcDz0w_wdFXOUp56FTr

And as you've seen, simplest summaries (including Hints and Warnings) are found at

[4.0] X3D Tooltips: Script
       https://www.web3d.org/x3d/content/X3dTooltips.html#Script

> I haven't figured out how to call shutdown() yet. document.onunload?
> 
> It would seem like if I copied field stuff from Composed Shader/Shader Part, that I would get the default fields?  I am not really sure.
> Should I look at Andreas' ProtoDeclare? Are there other places with fields?

Prototypes can contain Script nodes so however this is implemented needs to be compatible.  The design of fields and events are identical, with prototypes holding more involved capabilities for extensibility.

... so yes, you need to align well with Andreas' ProtoDeclare.  The only other nodes with fields are the Shader nodes, and they are slight variations on Script.

> Thanks,
> 
> John

Likewise, further questions welcome.  These are worthy efforts!  Good luck with your important efforts.

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



More information about the x3d-public mailing list