.TH "SoVRMLScript" 3 "Thu May 29 2014" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoVRMLScript \- .PP The \fBSoVRMLScript\fP class is used to control the scene using scripts\&. .PP \fBThe detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997)\&. It is copyright The Web3D Consortium, and is used by permission of the Consortium:\fP .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoNode\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fBSoType\fP \fBgetTypeId\fP (void) const " .br .RI "\fIReturns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. \fP" .ti -1c .RI "virtual void \fBdoAction\fP (\fBSoAction\fP *action)" .br .ti -1c .RI "virtual void \fBcallback\fP (\fBSoCallbackAction\fP *action)" .br .ti -1c .RI "virtual void \fBGLRender\fP (\fBSoGLRenderAction\fP *action)" .br .ti -1c .RI "virtual void \fBgetBoundingBox\fP (\fBSoGetBoundingBoxAction\fP *action)" .br .ti -1c .RI "virtual void \fBpick\fP (\fBSoPickAction\fP *action)" .br .ti -1c .RI "virtual void \fBhandleEvent\fP (\fBSoHandleEventAction\fP *action)" .br .ti -1c .RI "virtual void \fBwrite\fP (\fBSoWriteAction\fP *action)" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static void \fBinitClass\fP (void)" .br .ti -1c .RI "static \fBSoType\fP \fBgetClassTypeId\fP (void)" .br .ti -1c .RI "static void \fBsetScriptEvaluateCB\fP (SoVRMLScriptEvaluateCB *cb, void *closure)" .br .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "\fBSoMFString\fP \fBurl\fP" .br .ti -1c .RI "\fBSoSFBool\fP \fBdirectOutput\fP" .br .ti -1c .RI "\fBSoSFBool\fP \fBmustEvaluate\fP" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual void \fBcopyContents\fP (const \fBSoFieldContainer\fP *from, SbBool copyconn)" .br .ti -1c .RI "virtual void \fBnotify\fP (\fBSoNotList\fP *list)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP The \fBSoVRMLScript\fP class is used to control the scene using scripts\&. .PP \fBThe detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997)\&. It is copyright The Web3D Consortium, and is used by permission of the Consortium:\fP .PP .nf Script { exposedField MFString url [] field SFBool directOutput FALSE field SFBool mustEvaluate FALSE # And any number of: eventIn eventType eventName field fieldType fieldName initialValue eventOut eventType eventName } .fi .PP .PP The Script node is used to program behaviour in a scene\&. Script nodes typically .PP .IP "\(bu" 2 signify a change or user action; .IP "\(bu" 2 receive events from other nodes; .IP "\(bu" 2 contain a program module that performs some computation; .IP "\(bu" 2 effect change somewhere else in the scene by sending events\&. .PP .PP Each Script node has associated programming language code, referenced by the url field, that is executed to carry out the Script node's function\&. That code is referred to as the 'script' in the rest of this description\&. Details on the url field can be found in 4\&.5, VRML and the World Wide Web (http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#4.5)\&. .PP Browsers are not required to support any specific language\&. Detailed information on scripting languages is described in 4\&.12, Scripting (http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#4.12)\&. .PP Browsers supporting a scripting language for which a language binding is specified shall adhere to that language binding\&. Sometime before a script receives the first event it shall be initialized (any language-dependent or user-defined initialize() is performed)\&. .PP The script is able to receive and process events that are sent to it\&. Each event that can be received shall be declared in the Script node using the same syntax as is used in a prototype definition: .PP .PP .nf eventIn type name .fi .PP .PP The type can be any of the standard VRML fields (as defined in 5, Field and event reference)\&. Name shall be an identifier that is unique for this Script node\&. .PP The Script node is able to generate events in response to the incoming events\&. Each event that may be generated shall be declared in the Script node using the following syntax: .PP .PP .nf eventOut type name .fi .PP .PP With the exception of the url field, exposedFields are not allowed in Script nodes\&. .PP If the Script node's \fImustEvaluate\fP field is \fCFALSE\fP, the browser may delay sending input events to the script until its outputs are needed by the browser\&. If the \fImustEvaluate\fP field is TRUE, the browser shall send input events to the script as soon as possible, regardless of whether the outputs are needed\&. The \fImustEvaluate\fP field shall be set to TRUE only if the Script node has effects that are not known to the browser (such as sending information across the network)\&. Otherwise, poor performance may result\&. .PP Once the script has access to a VRML node (via an \fBSoSFNode\fP or \fBSoMFNode\fP value either in one of the Script node's fields or passed in as an eventIn), the script is able to read the contents of that node's exposed fields\&. .PP If the Script node's \fIdirectOutput\fP field is \fCTRUE\fP, the script may also send events directly to any node to which it has access, and may dynamically establish or break routes\&. .PP If directOutput is \fCFALSE\fP (the default), the script may only affect the rest of the world via events sent through its eventOuts\&. The results are undefined if directOutput is \fCFALSE\fP and the script sends events directly to a node to which it has access\&. .PP A script is able to communicate directly with the VRML browser to get information such as the current time and the current world URL\&. This is strictly defined by the API for the specific scripting language being used\&. The location of the Script node in the scene graph has no affect on its operation\&. For example, if a parent of a Script node is a Switch node with whichChoice set to '-1' (i\&.e\&., ignore its children), the Script node continues to operate as specified (i\&.e\&., it receives and sends events)\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoVRMLScript::getTypeId (void) const\fC [virtual]\fP" .PP Returns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. Usage example: .PP .PP .nf void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type } } .fi .PP .PP For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in \fIall\fP subclasses\&. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance \fBInventor/nodes/SoSubNode\&.h\fP (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine\&.h (for engine classes) and so on\&. .PP For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups\&. .PP Implements \fBSoBase\fP\&. .SS "void SoVRMLScript::doAction (\fBSoAction\fP *action)\fC [virtual]\fP" This function performs the typical operation of a node for any action\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::callback (\fBSoCallbackAction\fP *action)\fC [virtual]\fP" Action method for \fBSoCallbackAction\fP\&. .PP Simply updates the state according to how the node behaves for the render action, so the application programmer can use the \fBSoCallbackAction\fP for extracting information about the scene graph\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::GLRender (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGLRenderAction\fP\&. .PP This is called during rendering traversals\&. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::getBoundingBox (\fBSoGetBoundingBoxAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGetBoundingBoxAction\fP\&. .PP Calculates bounding box and center coordinates for node and modifies the values of the \fIaction\fP to encompass the bounding box for this node and to shift the center point for the scene more towards the one for this node\&. .PP Nodes influencing how geometry nodes calculates their bounding box also overrides this method to change the relevant state variables\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::pick (\fBSoPickAction\fP *action)\fC [virtual]\fP" Action method for \fBSoPickAction\fP\&. .PP Does common processing for \fBSoPickAction\fP \fIaction\fP instances\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::handleEvent (\fBSoHandleEventAction\fP *action)\fC [virtual]\fP" Action method for \fBSoHandleEventAction\fP\&. .PP Inspects the event data from \fIaction\fP, and processes it if it is something which this node should react to\&. .PP Nodes influencing relevant state variables for how event handling is done also overrides this method\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::write (\fBSoWriteAction\fP *action)\fC [virtual]\fP" Action method for \fBSoWriteAction\fP\&. .PP Writes out a node object, and any connected nodes, engines etc, if necessary\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::setScriptEvaluateCB (SoVRMLScriptEvaluateCB *cb, void *closure)\fC [static]\fP" Sets the callback that will be called when the script needs to be evaluated\&. .SS "void SoVRMLScript::copyContents (const \fBSoFieldContainer\fP *from, SbBoolcopyconnections)\fC [protected]\fP, \fC [virtual]\fP" Makes a deep copy of all data of \fIfrom\fP into this instance, \fIexcept\fP external scenegraph references if \fIcopyconnections\fP is \fCFALSE\fP\&. .PP This is the method that should be overridden by extension node / engine / dragger / whatever subclasses which needs to account for internal data that are not handled automatically\&. .PP For copying nodes from application code, you should not invoke this function directly, but rather call the \fBSoNode::copy()\fP function: .PP .PP .nf SoNode * mynewnode = templatenode->copy(); .fi .PP .PP The same also goes for engines\&. .PP Make sure that when you override the \fBcopyContents()\fP method in your extension class that you also make it call upwards to it's parent superclass in the inheritance hierarchy, as \fBcopyContents()\fP in for instance \fBSoNode\fP and \fBSoFieldContainer\fP does important work\&. It should go something like this: .PP .PP .nf void MyCoinExtensionNode::copyContents(const SoFieldContainer * from, SbBool copyconnections) { // let parent superclasses do their thing (copy fields, copy // instance name, etc etc) SoNode::copyContents(from, copyconnections); // [\&.\&.then copy internal data\&.\&.] } .fi .PP .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLScript::notify (\fBSoNotList\fP *l)\fC [protected]\fP, \fC [virtual]\fP" Notifies all auditors for this instance when changes are made\&. .PP Reimplemented from \fBSoNode\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.