You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_posts/reference/script-node-authoring-interface.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ A ECMAScript variable holds an instance of an object. If a name is defined as a
29
29
30
30
The names specified in the declaration of a function (the data value and the timestamp) are local to the function in which they are declared. It is a run-time error to assign to these variables.
31
31
32
-
Local variables can be created simply by assigning to a name that does not yet exist. Assigning to such a variable causes it take the type of the expression, so these local variables always have the type of the last assignment. Local variables are scoped by the block in which they were first introduced. Once that block is exited, the variable ceases to exist. Variables corresponding to `outputOnly` fields or `initializeOnly` fields of the Script node are global in scope.
32
+
Local variables can be created simply by assigning to a name that does not yet exist. Assigning to such a variable causes it take the type of the expression, so these local variables always have the type of the last assignment. Local variables are scoped by the block in which they were first introduced. Once that block is exited, the variable ceases to exist. Variables corresponding to `inputOutput`, `outputOnly` fields or `initializeOnly` fields of the Script node are global in scope.
33
33
34
34
Variable names must start with the a lowercase character ('a' through 'z'), an uppercase character ('A' through 'Z'), or an underscore ('_'). Subsequent characters can be any of these or a digit ('0' through '9'). Variable names are case sensitive.
35
35
@@ -88,11 +88,11 @@ function anInputField (value, time)
88
88
89
89
### Objects and Fields
90
90
91
-
For each field and `outputOnly` fields in the Script node containing the script there is a corresponding global variable with the same name. Field variables are persistent; they keep their last stored value across function calls. Local variables, on the other hand, are destroyed on exit from the block in which they were defined. Local variables defined in the outermost block of a function are destroyed when the function exits so they do not persist across function calls.
91
+
For each `inputOutput`, `outputOnly`and `initializeOnly` fields in the Script node containing the script there is a corresponding global variable with the same name. Field variables are persistent; they keep their last stored value across function calls. Local variables, on the other hand, are destroyed on exit from the block in which they were defined. Local variables defined in the outermost block of a function are destroyed when the function exits so they do not persist across function calls.
92
92
93
-
OutputOnly fields are very similar to field variables in that their values persist across function calls. But when an assignment is made to an `outputOnly`fields an event is generated.
93
+
`outputOnly` fields are very similar to field variables in that their values persist across function calls. But when an assignment is made to an `outputOnly`field an event is generated. The same happens with `inputOutput` fields.
94
94
95
-
Every object has a set of *properties* and *methods*. Properties are names on the object that can be selected (using the '.' operator) then used in an expression or as the target of an expression. Methods are names on the object that can be called (using the function call operator) to perform some operation on the object. For example:
95
+
Every object has a set of *properties* and *methods*. Properties are names on the object that can be selected (using the `.` operator) then used in an expression or as the target of an expression. Methods are names on the object that can be called (using the function call operator) to perform some operation on the object. For example:
96
96
97
97
```js
98
98
functionsomeFunction ()
@@ -103,11 +103,11 @@ function someFunction ()
103
103
}
104
104
```
105
105
106
-
The value *a.r* selects the property which corresponds to the red component of the color. The value *a .setHSV ()* selects the method which sets the color in HSV space.
106
+
The value `a.r` selects the property which corresponds to the red component of the color. The value `a .setHSV ()` selects the method which sets the color in HSV space.
107
107
108
108
### Object Construction
109
109
110
-
For each object type there is a corresponding constructor. Constructors typically take a flexible set of parameters to allow construction of objects with any initial value. MF objects are essentially arrays so they always take 0 or more parameters of the corresponding SF object type. A value of a given data type is created using the *new* keyword with the data type name. For instance:
110
+
For each object type there is a corresponding constructor. Constructors typically take a flexible set of parameters to allow construction of objects with any initial value. MF objects are essentially arrays so they always take 0 or more parameters of the corresponding SF object type. A value of a given data type is created using the `new` keyword with the data type name. For instance:
111
111
112
112
```js
113
113
let a =newSFVec3f (0, 1, 0); // 'a' has a SFVec3f containing 0, 1, 0.
@@ -361,7 +361,7 @@ The `shutdown` function takes no parameters. Events generated from it are given
361
361
362
362
## Accessing the Script Directly
363
363
364
-
Sometimes it is necessary to get access to the corresponding Script node. For this case, there is a special variable *this* in each callback function that holds a SFNode reference to the Script node.
364
+
Sometimes it is necessary to get access to the corresponding Script node. For this case, there is a special variable `this` in each callback function that holds a SFNode reference to the Script node.
0 commit comments