From 10469c1962172db954d02a3912053a99e2a0dfa3 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Thu, 28 Sep 2017 13:07:20 +0300 Subject: Document some of the VisualScript classes. --- doc/classes/@VisualScript.xml | 2 + doc/classes/VisualScript.xml | 48 +++++++++++++++++++++ doc/classes/VisualScriptBasicTypeConstant.xml | 4 ++ doc/classes/VisualScriptBuiltinFunc.xml | 62 +++++++++++++++++++++++++++ doc/classes/VisualScriptClassConstant.xml | 4 ++ doc/classes/VisualScriptComment.xml | 6 +++ doc/classes/VisualScriptCondition.xml | 2 + doc/classes/VisualScriptConstant.xml | 4 ++ doc/classes/VisualScriptConstructor.xml | 20 +++++++++ doc/classes/VisualScriptCustomNode.xml | 32 ++++++++++++++ doc/classes/VisualScriptDeconstruct.xml | 3 ++ doc/classes/VisualScriptEmitSignal.xml | 3 ++ doc/classes/VisualScriptEngineSingleton.xml | 3 ++ doc/classes/VisualScriptNode.xml | 13 ++++++ 14 files changed, 206 insertions(+) (limited to 'doc/classes') diff --git a/doc/classes/@VisualScript.xml b/doc/classes/@VisualScript.xml index 2392e3ecca..fe40bc45e9 100644 --- a/doc/classes/@VisualScript.xml +++ b/doc/classes/@VisualScript.xml @@ -1,8 +1,10 @@ + Built-in visual script functions. + A list of built-in visual script functions, see [VisualScriptBuiltinFunc] and [VisualScript]. diff --git a/doc/classes/VisualScript.xml b/doc/classes/VisualScript.xml index 0875aafcff..db516c229e 100644 --- a/doc/classes/VisualScript.xml +++ b/doc/classes/VisualScript.xml @@ -1,8 +1,12 @@ + A script implemented in the Visual Script programming environment. + A script implemented in the Visual Script programming environment. The script exends the functionality of all objects that instance it. + [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes. + You are most likely to use this class via the Visual Script editor or when writing plugins for it. @@ -15,6 +19,7 @@ + Add a custom signal with the specified name to the VisualScript. @@ -23,6 +28,7 @@ + Add a function with the specified name to the VisualScript. @@ -37,6 +43,7 @@ + Add a node to a function of the VisualScript. @@ -49,6 +56,7 @@ + Add a variable to the VisualScript, optionally giving it a default value or marking it as exported. @@ -63,6 +71,7 @@ + Add an argument to a custom signal added with [method add_custom_signal]. @@ -71,6 +80,7 @@ + Get the count of a custom signal's arguments. @@ -81,6 +91,7 @@ + Get the name of a custom signal's argument. @@ -91,6 +102,7 @@ + Get the type of a custom signal's argument. @@ -101,6 +113,7 @@ + Remove a specific custom signal's argument. @@ -113,6 +126,7 @@ + Rename a custom signal's argument. @@ -125,6 +139,7 @@ + Change the type of a custom signal's argument. @@ -137,6 +152,7 @@ + Swap two of the arguments of a custom signal. @@ -153,6 +169,7 @@ + Connect two data ports. The value of [code]from_node[/code]'s [code]from_port[/code] would be fed into [code]to_node[/code]'s [code]to_port[/code]. @@ -169,6 +186,7 @@ + Disconnect two data ports previously connected with [method data_connect]. @@ -177,6 +195,7 @@ + Returns the id of a function's entry point node. @@ -185,6 +204,7 @@ + Returns the position of the center of the screen for a given function. @@ -195,6 +215,7 @@ + Returns a node given its id and its function. @@ -205,6 +226,7 @@ + Returns a node's position in pixels. @@ -213,6 +235,7 @@ + Returns the default (initial) value of a variable. @@ -221,6 +244,7 @@ + Returns whether a variable is exported. @@ -229,6 +253,7 @@ + Returns the info for a given variable as a dictionary. The information includes its name, type, hint and usage. @@ -237,6 +262,7 @@ + Returns whether a signal exists with the specified name. @@ -253,6 +279,7 @@ + Returns whether the specified data ports are connected. @@ -261,6 +288,7 @@ + Returns whether a function exists with the specified name. @@ -271,6 +299,7 @@ + Returns whether a node exists with the given id. @@ -285,6 +314,7 @@ + Returns whether the specified sequence ports are connected. @@ -293,6 +323,7 @@ + Returns whether a variable exists with the specified name. @@ -301,6 +332,7 @@ + Remove a custom signal with the given name. @@ -309,6 +341,7 @@ + Remove a specific function and its nodes from the script. @@ -319,6 +352,7 @@ + Remove a specific node. @@ -327,6 +361,7 @@ + Remove a variable with the given name. @@ -337,6 +372,7 @@ + Change the name of a custom signal. @@ -347,6 +383,7 @@ + Change the name of a function. @@ -357,6 +394,7 @@ + Change the name of a variable. @@ -371,6 +409,8 @@ + Connect two sequence ports. The execution will flow from of [code]from_node[/code]'s [code]from_output[/code] into [code]to_node[/code]. + Unlike [method data_connect], there isn't a [code]to_port[/code], since the target node can have only one sequence port. @@ -385,6 +425,7 @@ + Disconnect two sequence ports previously connected with [method sequence_connect]. @@ -395,6 +436,7 @@ + Position the center of the screen for a function. @@ -403,6 +445,7 @@ + Set the base type of the script. @@ -415,6 +458,7 @@ + Position a node on the screen. @@ -425,6 +469,7 @@ + Change the default (initial) value of a variable. @@ -435,6 +480,7 @@ + Change whether a variable is exported. @@ -445,6 +491,7 @@ + Set a variable's info, using the same format as [method get_variable_info]. @@ -459,6 +506,7 @@ + Emitted when the ports of a node are changed. diff --git a/doc/classes/VisualScriptBasicTypeConstant.xml b/doc/classes/VisualScriptBasicTypeConstant.xml index 5b066f9925..cc09815481 100644 --- a/doc/classes/VisualScriptBasicTypeConstant.xml +++ b/doc/classes/VisualScriptBasicTypeConstant.xml @@ -1,8 +1,10 @@ + A Visual Script node representing a constant from the base types. + A Visual Script node representing a constant from base types, such as [Vector3.AXIS_X]. @@ -40,8 +42,10 @@ + The type to get the constant from. + The name of the constant to return. diff --git a/doc/classes/VisualScriptBuiltinFunc.xml b/doc/classes/VisualScriptBuiltinFunc.xml index a88633749e..f48f5a5308 100644 --- a/doc/classes/VisualScriptBuiltinFunc.xml +++ b/doc/classes/VisualScriptBuiltinFunc.xml @@ -1,8 +1,11 @@ + A Visual Script node used to call built-in functions. + A built-in function used inside a [VisualScript]. It is usually a math function or an utility function. + See also [@GDScript], for the same functions in the GDScript language. @@ -26,124 +29,183 @@ + The function to be executed. + Return the sine of the input. + Return the cosine of the input. + Return the tangent of the input. + Return the hyperbolic sine of the input. + Return the hyperbolic cosine of the input. + Return the hyperbolic tangent of the input. + Return the arc sine of the input. + Return the arc cosine of the input. + Return the arc tangent of the input. + Return the arc tangent of the input, using the signs of both parameters to determine the exact angle. + Return the square root of the input. + Return the remainder of one input divided by the other, using floating-point numbers. + Return the positive remainder of one input divided by the other, using floating-point numbers. + Return the input rounded down. + Return the input rounded up. + Return the input rounded to the nearest integer. + Return the absolute value of the input. + Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative. + Return the input raised to a given power. + Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use. + Return [b]e[/b] raised to the power of the input. [b]e[/b] sometimes called "Euler's number" is a mathematical constant whose value is approximately 2.71828. + Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist. + Return whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist. + Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in. + Return the number of digit places after the decimal that the first non-zero digit occurs. + Return the input snapped to a given step. + Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula [code]a + (a - b) * t[/code]. + Return the result of 'value' decreased by 'step' * 'amount'. + Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time. + Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function. + Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication. + Return a random floating-point value between the two inputs. + Set the seed for the random number generator. + Return a random value from the given seed, along with the new seed. + Convert the input from degrees to radians. + Convert the input from radians to degrees. + Convert the input from linear volume to decibel volume. + Convert the input from decibel volume to linear volume. + Return the greater of the two numbers, also known as their maximum. + Return the lesser of the two numbers, also known as their minimum. + Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to `min(max(input, range_low), range_high)` + Return the nearest power of 2 to the input. + Create a [WeakRef] from the input. + Create a [FuncRef] from the input. + Convert between types. + Return the type of the input as an integer. Check [enum Variant.Type] for the integers that might be returned. + Checks if a type is registered in the [ClassDB]. + Return a character with the given ascii value. + Convert the input to a string. + Print the given string to the output window. + Print the given string to the standard error output. + Print the given string to the standard output, without adding a newline. + Serialize a [Variant] to a string. + Deserialize a [Variant] from a string serialized using [VAR_TO_STR]. + Serialize a [Variant] to a [PoolByteArray]. + Deserialize a [Variant] from a [PoolByteArray] serialized using [VAR_TO_BYTES]. + Return the [Color] with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc. + The maximum value the [member function] property can have. diff --git a/doc/classes/VisualScriptClassConstant.xml b/doc/classes/VisualScriptClassConstant.xml index 5e43b4972c..70e7de5dd9 100644 --- a/doc/classes/VisualScriptClassConstant.xml +++ b/doc/classes/VisualScriptClassConstant.xml @@ -1,8 +1,10 @@ + A Visual Script node representing a constant from a class. + A Visual Script node representing a constant from the classes, such as [@GlobalScope.TYPE_INT]. @@ -40,8 +42,10 @@ + The type to get the constant from. + The name of the constant to return. diff --git a/doc/classes/VisualScriptComment.xml b/doc/classes/VisualScriptComment.xml index be4eefd775..da65998e78 100644 --- a/doc/classes/VisualScriptComment.xml +++ b/doc/classes/VisualScriptComment.xml @@ -1,8 +1,11 @@ + A Visual Script node used to store information for the developer. + A Visual Script node used to display text, so that code is more readable and better documented. + Comment nodes can be resized so they encompass a group of nodes. @@ -54,10 +57,13 @@ + The text inside the comment node. + The size (in pixels) of the comment node. + The title of the comment node. diff --git a/doc/classes/VisualScriptCondition.xml b/doc/classes/VisualScriptCondition.xml index 73f1b69c02..de814a6b17 100644 --- a/doc/classes/VisualScriptCondition.xml +++ b/doc/classes/VisualScriptCondition.xml @@ -1,8 +1,10 @@ + A Visual Script node which branches the flow. + A Visual Script node which switches the flow based on a boolean. It acts similar to if/else in typical programming languages. diff --git a/doc/classes/VisualScriptConstant.xml b/doc/classes/VisualScriptConstant.xml index b0af3bda98..508087a928 100644 --- a/doc/classes/VisualScriptConstant.xml +++ b/doc/classes/VisualScriptConstant.xml @@ -1,8 +1,10 @@ + A Visual Script node which returns a constant value. + A Visual Script node which returns the specified constant value. @@ -40,8 +42,10 @@ + The constant's type. + The constant's value. diff --git a/doc/classes/VisualScriptConstructor.xml b/doc/classes/VisualScriptConstructor.xml index e8afd36b9c..3b1fc5e385 100644 --- a/doc/classes/VisualScriptConstructor.xml +++ b/doc/classes/VisualScriptConstructor.xml @@ -1,8 +1,10 @@ + A Visual Script node which calls a base type constructor. + A Visual Script node which calls a base type constructor. It can be used for type conversion as well. @@ -40,8 +42,26 @@ + The constructor function's method info. Has roughly the following structure: + [codeblock] + { + name = "string", + args = [{ + name = "string" + class_name = "string" + type = TYPE_* + hint = PROPERTY_HINT_* + hint_string = "string" + }] + default_args = [] # Array of variants + flags = METHOD_FLAG_* + id = 0 + return = {type = TYPE_*} + } + [/codeblock] + The type to be constructed. diff --git a/doc/classes/VisualScriptCustomNode.xml b/doc/classes/VisualScriptCustomNode.xml index ec442e993c..e321c8854a 100644 --- a/doc/classes/VisualScriptCustomNode.xml +++ b/doc/classes/VisualScriptCustomNode.xml @@ -1,8 +1,10 @@ + A scripted Visual Script node. + A custom Visual Script node which can be scripted in powerful ways. @@ -13,18 +15,21 @@ + Return the node's title. + Return the node's category. + Return the count of input value ports. @@ -33,6 +38,7 @@ + Return the specified input port's name. @@ -41,12 +47,14 @@ + Return the specified input port's type. See the TYPE_* enum in [@GlobalScope]. + Return the amount of output [b]sequence[/b] ports. @@ -55,12 +63,14 @@ + Return the specified [b]sequence[/b] output's name. + Return the amount of output value ports. @@ -69,6 +79,7 @@ + Return the specified output's name. @@ -77,24 +88,28 @@ + Return the specified output's type. See the TYPE_* enum in [@GlobalScope]. + Return the custom node's text, which is shown right next to the input [b]sequence[/b] port (if there is none, on the place that is usually taken by it). + Return the size of the custom node's working memory. See [method _step] for more details. + Return whether the custom node has an input [b]sequence[/b] port. @@ -109,25 +124,42 @@ + Execute the custom node's logic, returning the index of the output sequence port to use or a [String] when there is an error. + + The [code]inputs[/code] array contains the values of the input ports. + [code]outputs[/code] is an array whose indices should be set to the respective outputs. + The [code]start_mode[/code] is usually [code]START_MODE_BEGIN_SEQUENCE[/code], unless you have used the STEP_* constants. + [code]working_mem[/code] is an array which can be used to persist information between runs of the custom node. + + When returning, you can mask the returned value with one of the STEP_* constants. + The start mode used the first time when [method _step] is called. + The start mode used when [method _step] is called after coming back from a STEP_PUSH_STACK_BIT. + The start mode used when [method _step] is called after resuming from STEP_YIELD_BIT. + Hint used by [method _step] to tell that control should return to it when there is no other node left to execute. + This is used by [VisualScriptCondition] to redirect the sequence to the "Done" port after the true/false branch has finished execution. + Hint used by [method _step] to tell that control should return back, either hitting a previous STEP_PUSH_STACK_BIT or exiting the function. + Hint used by [method _step] to tell that control should stop and exit the function. + Hint used by [method _step] to tell that the function should be yielded. + Using this requires you to have at least one working memory slot, which is used for the [VisualScriptFunctionState]. diff --git a/doc/classes/VisualScriptDeconstruct.xml b/doc/classes/VisualScriptDeconstruct.xml index 5bb12539af..cd7d79ae56 100644 --- a/doc/classes/VisualScriptDeconstruct.xml +++ b/doc/classes/VisualScriptDeconstruct.xml @@ -1,8 +1,10 @@ + A Visual Script node which deconstructs a base type instance into its parts. + A Visual Script node which deconstructs a base type instance into its parts. @@ -28,6 +30,7 @@ + The type to deconstruct. diff --git a/doc/classes/VisualScriptEmitSignal.xml b/doc/classes/VisualScriptEmitSignal.xml index 21af3c6ea0..844b5a40ec 100644 --- a/doc/classes/VisualScriptEmitSignal.xml +++ b/doc/classes/VisualScriptEmitSignal.xml @@ -1,8 +1,10 @@ + A Visual Script node which emits a specified signal. + A Visual Script node which emits a specified signal when it is executed. @@ -26,6 +28,7 @@ + The signal to emit. diff --git a/doc/classes/VisualScriptEngineSingleton.xml b/doc/classes/VisualScriptEngineSingleton.xml index c00fd2a0a4..6606f10f11 100644 --- a/doc/classes/VisualScriptEngineSingleton.xml +++ b/doc/classes/VisualScriptEngineSingleton.xml @@ -1,8 +1,10 @@ + A Visual Script node returning a singleton from [@GlobalScope] + A Visual Script node returning a singleton from [@GlobalScope] @@ -26,6 +28,7 @@ + The singleton's name. diff --git a/doc/classes/VisualScriptNode.xml b/doc/classes/VisualScriptNode.xml index dbb75e69fa..74ec9bdc2e 100644 --- a/doc/classes/VisualScriptNode.xml +++ b/doc/classes/VisualScriptNode.xml @@ -1,8 +1,10 @@ + A node which is part of a [VisualScript]. + A node which is part of a [VisualScript]. Not to be confused with [Node], which is a part of a [SceneTree]. @@ -15,12 +17,21 @@ + Returns the default value of a given port. The default value is used when nothing is connected to the port. + Returns the [VisualScript] instance the node is bound to. + + + + + + + Notify that the node's ports have changed. Usually used in conjunction with [VisualScriptCustomNode] . @@ -31,6 +42,7 @@ + Change the default value of a given port. @@ -41,6 +53,7 @@ + Emitted when the available input/output ports are changed. -- cgit v1.2.3