diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub deleted file mode 100644 index 16faea08d..000000000 --- a/modules/visual_script/SCsub +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -Import("env") -Import("env_modules") - -env_vs = env_modules.Clone() - -env_vs.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py deleted file mode 100644 index b15479797..000000000 --- a/modules/visual_script/config.py +++ /dev/null @@ -1,62 +0,0 @@ -def can_build(env, platform): - return True - - -def configure(env): - pass - - -def get_doc_classes(): - return [ - "VisualScriptBasicTypeConstant", - "VisualScriptBuiltinFunc", - "VisualScriptClassConstant", - "VisualScriptComment", - "VisualScriptComposeArray", - "VisualScriptCondition", - "VisualScriptConstant", - "VisualScriptConstructor", - "VisualScriptCustomNode", - "VisualScriptDeconstruct", - "VisualScriptEditor", - "VisualScriptEmitSignal", - "VisualScriptEngineSingleton", - "VisualScriptExpression", - "VisualScriptFunctionCall", - "VisualScriptFunctionState", - "VisualScriptFunction", - "VisualScriptGlobalConstant", - "VisualScriptIndexGet", - "VisualScriptIndexSet", - "VisualScriptInputAction", - "VisualScriptIterator", - "VisualScriptLists", - "VisualScriptLocalVarSet", - "VisualScriptLocalVar", - "VisualScriptMathConstant", - "VisualScriptNode", - "VisualScriptOperator", - "VisualScriptPreload", - "VisualScriptPropertyGet", - "VisualScriptPropertySet", - "VisualScriptResourcePath", - "VisualScriptReturn", - "VisualScriptSceneNode", - "VisualScriptSceneTree", - "VisualScriptSelect", - "VisualScriptSelf", - "VisualScriptSequence", - "VisualScriptSubCall", - "VisualScriptSwitch", - "VisualScriptTypeCast", - "VisualScriptVariableGet", - "VisualScriptVariableSet", - "VisualScriptWhile", - "VisualScript", - "VisualScriptYieldSignal", - "VisualScriptYield", - ] - - -def get_doc_path(): - return "doc_classes" diff --git a/modules/visual_script/doc_classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml deleted file mode 100644 index 889ea17af..000000000 --- a/modules/visual_script/doc_classes/VisualScript.xml +++ /dev/null @@ -1,373 +0,0 @@ - - - - A script implemented in the Visual Script programming environment. - - - A script implemented in the Visual Script programming environment. The script extends 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. - - - $DOCS_URL/tutorials/scripting/visual_script/index.html - - - - - - - Add a custom signal with the specified name to the VisualScript. - - - - - - - Add a function with the specified name to the VisualScript. - - - - - - - - - - Add a node to a function of the VisualScript. - - - - - - - - - Add a variable to the VisualScript, optionally giving it a default value or marking it as exported. - - - - - - - - - - Add an argument to a custom signal added with [method add_custom_signal]. - - - - - - - Get the count of a custom signal's arguments. - - - - - - - - Get the name of a custom signal's argument. - - - - - - - - Get the type of a custom signal's argument. - - - - - - - - Remove a specific custom signal's argument. - - - - - - - - - Rename a custom signal's argument. - - - - - - - - - Change the type of a custom signal's argument. - - - - - - - - - Swap two of the arguments of a custom signal. - - - - - - - - - - - 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]. - - - - - - - - - - - Disconnect two data ports previously connected with [method data_connect]. - - - - - - - Returns the id of a function's entry point node. - - - - - - - Returns the position of the center of the screen for a given function. - - - - - - - - Returns a node given its id and its function. - - - - - - - - Returns a node's position in pixels. - - - - - - - Returns the default (initial) value of a variable. - - - - - - - Returns whether a variable is exported. - - - - - - - Returns the information for a given variable as a dictionary. The information includes its name, type, hint and usage. - - - - - - - Returns whether a signal exists with the specified name. - - - - - - - - - - - Returns whether the specified data ports are connected. - - - - - - - Returns whether a function exists with the specified name. - - - - - - - - Returns whether a node exists with the given id. - - - - - - - - - - Returns whether the specified sequence ports are connected. - - - - - - - Returns whether a variable exists with the specified name. - - - - - - - Remove a custom signal with the given name. - - - - - - - Remove a specific function and its nodes from the script. - - - - - - - - Remove a specific node. - - - - - - - Remove a variable with the given name. - - - - - - - - Change the name of a custom signal. - - - - - - - - Change the name of a function. - - - - - - - - Change the name of a variable. - - - - - - - - - - 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. - - - - - - - - - - Disconnect two sequence ports previously connected with [method sequence_connect]. - - - - - - - - Position the center of the screen for a function. - - - - - - - Set the base type of the script. - - - - - - - - - Position a node on the screen. - - - - - - - - Change the default (initial) value of a variable. - - - - - - - - Change whether a variable is exported. - - - - - - - - Set a variable's info, using the same format as [method get_variable_info]. - - - - - - - - - Emitted when the ports of a node are changed. - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml deleted file mode 100644 index 054660076..000000000 --- a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - A Visual Script node representing a constant from the base types. - - - A Visual Script node representing a constant from base types, such as [constant Vector3.AXIS_X]. - - - - - - - - The type to get the constant from. - - - The name of the constant to return. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml deleted file mode 100644 index bc88b5d5e..000000000 --- a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - 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. - - - - - - - - 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 the mathematical constant [b]e[/b] raised to the specified power of the input. [b]e[/b] has an approximate value of 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]. - - - - - - - Moves the number toward a value, based on the third input. - - - Return the result of [code]value[/code] decreased by [code]step[/code] * [code]amount[/code]. - - - 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. - - - Converts a 2D point expressed in the polar coordinate system (a distance from the origin [code]r[/code] and an angle [code]th[/code]) to the cartesian coordinate system (X and Y axis). - - - Converts a 2D point expressed in the cartesian coordinate system (X and Y axis) to the polar coordinate system (a distance from the origin and an angle). - - - - - - - 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 [code]min(max(input, range_low), range_high)[/code]. - - - 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 [constant VAR_TO_STR]. - - - Serialize a [Variant] to a [PoolByteArray]. - - - Deserialize a [Variant] from a [PoolByteArray] serialized using [constant VAR_TO_BYTES]. - - - Return the [Color] with the given name and alpha ranging from 0 to 1. - [b]Note:[/b] Names are defined in [code]color_names.inc[/code]. - - - Return a number smoothly interpolated between the first two inputs, based on the third input. Similar to [constant MATH_LERP], but interpolates faster at the beginning and slower at the end. Using Hermite interpolation formula: - [codeblock] - var t = clamp((weight - from) / (to - from), 0.0, 1.0) - return t * t * (3.0 - 2.0 * t) - [/codeblock] - - - - - - - - - Represents the size of the [enum BuiltinFunc] enum. - - - diff --git a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml deleted file mode 100644 index dd513dc33..000000000 --- a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - Gets a constant from a given class. - - - This node returns a constant from a given class, such as [constant TYPE_INT]. See the given class' documentation for available constants. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (variant): [code]value[/code] - - - - - - - - The constant's parent class. - - - The constant to return. See the given class for its available constants. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptComment.xml b/modules/visual_script/doc_classes/VisualScriptComment.xml deleted file mode 100644 index de55de3e9..000000000 --- a/modules/visual_script/doc_classes/VisualScriptComment.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - A Visual Script node used to annotate the script. - - - A Visual Script node used to display annotations in the script, so that code may be documented. - Comment nodes can be resized so they encompass a group of nodes. - - - - - - - - The text inside the comment node. - - - The comment node's size (in pixels). - - - The comment node's title. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptComposeArray.xml b/modules/visual_script/doc_classes/VisualScriptComposeArray.xml deleted file mode 100644 index d354bab68..000000000 --- a/modules/visual_script/doc_classes/VisualScriptComposeArray.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - A Visual Script Node used to create array from a list of items. - - - A Visual Script Node used to compose array from the list of elements provided with custom in-graph UI hard coded in the VisualScript Editor. - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptCondition.xml b/modules/visual_script/doc_classes/VisualScriptCondition.xml deleted file mode 100644 index 20769124f..000000000 --- a/modules/visual_script/doc_classes/VisualScriptCondition.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - A Visual Script node which branches the flow. - - - A Visual Script node that checks a [bool] input port. If [code]true[/code], it will exit via the "true" sequence port. If [code]false[/code], it will exit via the "false" sequence port. After exiting either, it exits via the "done" port. Sequence ports may be left disconnected. - [b]Input Ports:[/b] - - Sequence: [code]if (cond) is[/code] - - Data (boolean): [code]cond[/code] - [b]Output Ports:[/b] - - Sequence: [code]true[/code] - - Sequence: [code]false[/code] - - Sequence: [code]done[/code] - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptConstant.xml b/modules/visual_script/doc_classes/VisualScriptConstant.xml deleted file mode 100644 index 35d58c587..000000000 --- a/modules/visual_script/doc_classes/VisualScriptConstant.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - Gets a contant's value. - - - This node returns a constant's value. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (variant): [code]get[/code] - - - - - - - - The constant's type. - - - The constant's value. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml deleted file mode 100644 index 5f95bfe37..000000000 --- a/modules/visual_script/doc_classes/VisualScriptConstructor.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml deleted file mode 100644 index 25bfc20da..000000000 --- a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - A scripted Visual Script node. - - - A custom Visual Script node which can be scripted in powerful ways. - - - - - - - - Return the node's title. - - - - - - Return the node's category. - - - - - - Return the count of input value ports. - - - - - - - Return the specified input port's hint. See the [enum @GlobalScope.PropertyHint] hints. - - - - - - - Return the specified input port's hint string. - - - - - - - Return the specified input port's name. - - - - - - - Return the specified input port's type. See the [enum Variant.Type] values. - - - - - - Return the amount of output [b]sequence[/b] ports. - - - - - - - Return the specified [b]sequence[/b] output's name. - - - - - - Return the amount of output value ports. - - - - - - - Return the specified output port's hint. See the [enum @GlobalScope.PropertyHint] hints. - - - - - - - Return the specified output port's hint string. - - - - - - - Return the specified output port's name. - - - - - - - Return the specified output port's type. See the [enum Variant.Type] values. - - - - - - 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. - - - - - - - - - - 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 [constant START_MODE_BEGIN_SEQUENCE], unless you have used the [code]STEP_*[/code] constants. - [code]working_mem[/code] is an array which can be used to persist information between runs of the custom node. The size needs to be predefined using [method _get_working_memory_size]. - When returning, you can mask the returned value with one of the [code]STEP_*[/code] 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 [constant STEP_PUSH_STACK_BIT]. - - - The start mode used when [method _step] is called after resuming from [constant 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 [code]true[/code]/[code]false[/code] branch has finished execution. - - - Hint used by [method _step] to tell that control should return back, either hitting a previous [constant 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/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml deleted file mode 100644 index 797aa5165..000000000 --- a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - 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. - - - - - - - - The type to deconstruct. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml deleted file mode 100644 index de160d49a..000000000 --- a/modules/visual_script/doc_classes/VisualScriptEditor.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - Add a custom Visual Script node to the editor. It'll be placed under "Custom Nodes" with the [code]category[/code] as the parameter. - - - - - - - - Remove a custom Visual Script node from the editor. Custom nodes already placed on scripts won't be removed. - - - - - - - Emitted when a custom Visual Script node is added or removed. - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml deleted file mode 100644 index 1dca9169d..000000000 --- a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Emits a specified signal. - - - Emits a specified signal when it is executed. - [b]Input Ports:[/b] - - Sequence: [code]emit[/code] - [b]Output Ports:[/b] - - Sequence - - - - - - - - The signal to emit. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml deleted file mode 100644 index a39100104..000000000 --- a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - A Visual Script node returning a singleton from [@GlobalScope]. - - - A Visual Script node returning a singleton from [@GlobalScope]. - - - - - - - - The singleton's name. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptExpression.xml b/modules/visual_script/doc_classes/VisualScriptExpression.xml deleted file mode 100644 index d180197da..000000000 --- a/modules/visual_script/doc_classes/VisualScriptExpression.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - A Visual Script node that can execute a custom expression. - - - A Visual Script node that can execute a custom expression. Values can be provided for the input and the expression result can be retrieved from the output. - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptFunction.xml b/modules/visual_script/doc_classes/VisualScriptFunction.xml deleted file mode 100644 index d9e68b15f..000000000 --- a/modules/visual_script/doc_classes/VisualScriptFunction.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - A Visual Script node representing a function. - - - [VisualScriptFunction] represents a function header. It is the starting point for the function body and can be used to tweak the function's properties (e.g. RPC mode). - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml deleted file mode 100644 index 74319585c..000000000 --- a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - A Visual Script node for calling a function. - - - [VisualScriptFunctionCall] is created when you add or drag and drop a function onto the Visual Script graph. It allows to tweak parameters of the call, e.g. what object the function is called on. - - - - - - - - The script to be used when [member call_mode] is set to [constant CALL_MODE_INSTANCE]. - - - The base type to be used when [member call_mode] is set to [constant CALL_MODE_INSTANCE]. - - - The type to be used when [member call_mode] is set to [constant CALL_MODE_BASIC_TYPE]. - - - [code]call_mode[/code] determines the target object on which the method will be called. See [enum CallMode] for options. - - - The name of the function to be called. - - - The node path to use when [member call_mode] is set to [constant CALL_MODE_NODE_PATH]. - - - The mode for RPC calls. See [method Node.rpc] for more details and [enum RPCCallMode] for available options. - - - The singleton to call the method on. Used when [member call_mode] is set to [constant CALL_MODE_SINGLETON]. - - - Number of default arguments that will be used when calling the function. Can't be higher than the number of available default arguments in the method's declaration. - - - If [code]false[/code], call errors (e.g. wrong number of arguments) will be ignored. - - - - - The method will be called on this [Object]. - - - The method will be called on the given [Node] in the scene tree. - - - The method will be called on an instanced node with the given type and script. - - - The method will be called on a GDScript basic type (e.g. [Vector2]). - - - The method will be called on a singleton. - - - The method will be called locally. - - - The method will be called remotely. - - - The method will be called remotely using an unreliable protocol. - - - The method will be called remotely for the given peer. - - - The method will be called remotely for the given peer, using an unreliable protocol. - - - diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml deleted file mode 100644 index 5d36d5437..000000000 --- a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - A Visual Script node representing a function state. - - - [VisualScriptFunctionState] is returned from [VisualScriptYield] and can be used to resume a paused function call. - - - - - - - - - - - Connects this [VisualScriptFunctionState] to a signal in the given object to automatically resume when it's emitted. - - - - - - Returns whether the function state is valid. - - - - - - - Resumes the function to run from the point it was yielded. - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml deleted file mode 100644 index 28134bf05..000000000 --- a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - A Visual Script node returning a constant from [@GlobalScope]. - - - A Visual Script node returning a constant from [@GlobalScope]. - - - - - - - - The constant to be used. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml deleted file mode 100644 index cf46fbad5..000000000 --- a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - A Visual Script node for getting a value from an array or a dictionary. - - - [VisualScriptIndexGet] will return the value stored in an array or a dictionary under the given index. - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml deleted file mode 100644 index 68b41c22d..000000000 --- a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - A Visual Script node for setting a value in an array or a dictionary. - - - [VisualScriptIndexSet] will set the value stored in an array or a dictionary under the given index to the provided new value. - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml deleted file mode 100644 index b15009af6..000000000 --- a/modules/visual_script/doc_classes/VisualScriptInputAction.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - A Visual Script node returning a state of an action. - - - [VisualScriptInputAction] can be used to check if an action is pressed or released. - - - - - - - - Name of the action. - - - State of the action to check. See [enum Mode] for options. - - - - - [code]True[/code] if action is pressed. - - - [code]True[/code] if action is released (i.e. not pressed). - - - [code]True[/code] on the frame the action was pressed. - - - [code]True[/code] on the frame the action was released. - - - diff --git a/modules/visual_script/doc_classes/VisualScriptIterator.xml b/modules/visual_script/doc_classes/VisualScriptIterator.xml deleted file mode 100644 index 4419e613a..000000000 --- a/modules/visual_script/doc_classes/VisualScriptIterator.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - Steps through items in a given input. - - - This node steps through each item in a given input. Input can be any sequence data type, such as an [Array] or [String]. When each item has been processed, execution passed out the [code]exit[/code] Sequence port. - [b]Input Ports:[/b] - - Sequence: [code]for (elem) in (input)[/code] - - Data (variant): [code]input[/code] - [b]Output Ports:[/b] - - Sequence: [code]each[/code] - - Sequence: [code]exit[/code] - - Data (variant): [code]elem[/code] - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptLists.xml b/modules/visual_script/doc_classes/VisualScriptLists.xml deleted file mode 100644 index 6756149fd..000000000 --- a/modules/visual_script/doc_classes/VisualScriptLists.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - A Visual Script virtual class for in-graph editable nodes. - - - A Visual Script virtual class that defines the shape and the default behavior of the nodes that have to be in-graph editable nodes. - - - - - - - - - - - Adds an input port to the Visual Script node. - - - - - - - - - Adds an output port to the Visual Script node. - - - - - - - Removes an input port from the Visual Script node. - - - - - - - Removes an output port from the Visual Script node. - - - - - - - - Sets the name of an input port. - - - - - - - - Sets the type of an input port. - - - - - - - - Sets the name of an output port. - - - - - - - - Sets the type of an output port. - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml deleted file mode 100644 index fcded49d5..000000000 --- a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - Gets a local variable's value. - - - Returns a local variable's value. "Var Name" must be supplied, with an optional type. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (variant): [code]get[/code] - - - - - - - - The local variable's type. - - - The local variable's name. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml deleted file mode 100644 index 9737cb2c9..000000000 --- a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - Changes a local variable's value. - - - Changes a local variable's value to the given input. The new value is also provided on an output Data port. - [b]Input Ports:[/b] - - Sequence - - Data (variant): [code]set[/code] - [b]Output Ports:[/b] - - Sequence - - Data (variant): [code]get[/code] - - - - - - - - The local variable's type. - - - The local variable's name. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml deleted file mode 100644 index 5bf90e829..000000000 --- a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Commonly used mathematical constants. - - - Provides common math constants, such as Pi, on an output Data port. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (variant): [code]get[/code] - - - - - - - - The math constant. - - - - - Unity: [code]1[/code]. - - - Pi: [code]3.141593[/code]. - - - Pi divided by two: [code]1.570796[/code]. - - - Tau: [code]6.283185[/code]. - - - Mathematical constant [code]e[/code], the natural log base: [code]2.718282[/code]. - - - Square root of two: [code]1.414214[/code]. - - - Infinity: [code]inf[/code]. - - - Not a number: [code]nan[/code]. - - - Represents the size of the [enum MathConstant] enum. - - - diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml deleted file mode 100644 index fb9b88a13..000000000 --- a/modules/visual_script/doc_classes/VisualScriptNode.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - 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]. - - - - - - - - - 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] . - - - - - - - - Change the default value of a given port. - - - - - - - Emitted when the available input/output ports are changed. - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptOperator.xml b/modules/visual_script/doc_classes/VisualScriptOperator.xml deleted file mode 100644 index 21a88fadf..000000000 --- a/modules/visual_script/doc_classes/VisualScriptOperator.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - A Visual Script node that performs an operation on two values. - - - [b]Input Ports:[/b] - - Data (variant): [code]A[/code] - - Data (variant): [code]B[/code] - [b]Output Ports:[/b] - - Data (variant): [code]result[/code] - - - - - - - - The operation to be performed. See [enum Variant.Operator] for available options. - - - The type of the values for this operation. See [enum Variant.Type] for available options. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptPreload.xml b/modules/visual_script/doc_classes/VisualScriptPreload.xml deleted file mode 100644 index f22e4c34b..000000000 --- a/modules/visual_script/doc_classes/VisualScriptPreload.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Creates a new [Resource] or loads one from the filesystem. - - - Creates a new [Resource] or loads one from the filesystem. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (object): [code]res[/code] - - - - - - - - The [Resource] to load. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml deleted file mode 100644 index 6e475f2f9..000000000 --- a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - A Visual Script node returning a value of a property from an [Object]. - - - [VisualScriptPropertyGet] can return a value of any property from the current object or other objects. - - - - - - - - The script to be used when [member set_mode] is set to [constant CALL_MODE_INSTANCE]. - - - The base type to be used when [member set_mode] is set to [constant CALL_MODE_INSTANCE]. - - - The type to be used when [member set_mode] is set to [constant CALL_MODE_BASIC_TYPE]. - - - The indexed name of the property to retrieve. See [method Object.get_indexed] for details. - - - The node path to use when [member set_mode] is set to [constant CALL_MODE_NODE_PATH]. - - - The name of the property to retrieve. Changing this will clear [member index]. - - - [code]set_mode[/code] determines the target object from which the property will be retrieved. See [enum CallMode] for options. - - - - - The property will be retrieved from this [Object]. - - - The property will be retrieved from the given [Node] in the scene tree. - - - The property will be retrieved from an instanced node with the given type and script. - - - The property will be retrieved from a GDScript basic type (e.g. [Vector2]). - - - diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml deleted file mode 100644 index a113aa434..000000000 --- a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - A Visual Script node that sets a property of an [Object]. - - - [VisualScriptPropertySet] can set the value of any property from the current object or other objects. - - - - - - - - The additional operation to perform when assigning. See [enum AssignOp] for options. - - - The script to be used when [member set_mode] is set to [constant CALL_MODE_INSTANCE]. - - - The base type to be used when [member set_mode] is set to [constant CALL_MODE_INSTANCE]. - - - The type to be used when [member set_mode] is set to [constant CALL_MODE_BASIC_TYPE]. - - - The indexed name of the property to set. See [method Object.set_indexed] for details. - - - The node path to use when [member set_mode] is set to [constant CALL_MODE_NODE_PATH]. - - - The name of the property to set. Changing this will clear [member index]. - - - [code]set_mode[/code] determines the target object on which the property will be set. See [enum CallMode] for options. - - - - - The property will be set on this [Object]. - - - The property will be set on the given [Node] in the scene tree. - - - The property will be set on an instanced node with the given type and script. - - - The property will be set on a GDScript basic type (e.g. [Vector2]). - - - The property will be assigned regularly. - - - The value will be added to the property. Equivalent of doing [code]+=[/code]. - - - The value will be subtracted from the property. Equivalent of doing [code]-=[/code]. - - - The property will be multiplied by the value. Equivalent of doing [code]*=[/code]. - - - The property will be divided by the value. Equivalent of doing [code]/=[/code]. - - - A modulo operation will be performed on the property and the value. Equivalent of doing [code]%=[/code]. - - - The property will be binarly shifted to the left by the given value. Equivalent of doing [code]<<[/code]. - - - The property will be binarly shifted to the right by the given value. Equivalent of doing [code]>>[/code]. - - - A binary [code]AND[/code] operation will be performed on the property. Equivalent of doing [code]&=[/code]. - - - A binary [code]OR[/code] operation will be performed on the property. Equivalent of doing [code]|=[/code]. - - - A binary [code]XOR[/code] operation will be performed on the property. Equivalent of doing [code]^=[/code]. - - - diff --git a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml deleted file mode 100644 index c5a365464..000000000 --- a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptReturn.xml b/modules/visual_script/doc_classes/VisualScriptReturn.xml deleted file mode 100644 index 55196a55e..000000000 --- a/modules/visual_script/doc_classes/VisualScriptReturn.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Exits a function and returns an optional value. - - - Ends the execution of a function and returns control to the calling function. Optionally, it can return a [Variant] value. - [b]Input Ports:[/b] - - Sequence - - Data (variant): [code]result[/code] (optional) - [b]Output Ports:[/b] - none - - - - - - - - If [code]true[/code], the [code]return[/code] input port is available. - - - The return value's data type. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml deleted file mode 100644 index ca49f93a2..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Node reference. - - - A direct reference to a node. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data: [code]node[/code] (obj) - - - - - - - - The node's path in the scene tree. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml deleted file mode 100644 index ae06298bd..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - A Visual Script node for accessing [SceneTree] methods. - - - A Visual Script node for accessing [SceneTree] methods. - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSelect.xml b/modules/visual_script/doc_classes/VisualScriptSelect.xml deleted file mode 100644 index ba1cfef17..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSelect.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Chooses between two input values. - - - Chooses between two input values based on a Boolean condition. - [b]Input Ports:[/b] - - Data (boolean): [code]cond[/code] - - Data (variant): [code]a[/code] - - Data (variant): [code]b[/code] - [b]Output Ports:[/b] - - Data (variant): [code]out[/code] - - - - - - - - The input variables' type. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSelf.xml b/modules/visual_script/doc_classes/VisualScriptSelf.xml deleted file mode 100644 index b4bb44cf3..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSelf.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - Outputs a reference to the current instance. - - - Provides a reference to the node running the visual script. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (object): [code]instance[/code] - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSequence.xml b/modules/visual_script/doc_classes/VisualScriptSequence.xml deleted file mode 100644 index eb237d2c0..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSequence.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Executes a series of Sequence ports. - - - Steps through a series of one or more output Sequence ports. The [code]current[/code] data port outputs the currently executing item. - [b]Input Ports:[/b] - - Sequence: [code]in order[/code] - [b]Output Ports:[/b] - - Sequence: [code]1[/code] - - Sequence: [code]2 - n[/code] (optional) - - Data (int): [code]current[/code] - - - - - - - - The number of steps in the sequence. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml deleted file mode 100644 index 735d3e55d..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSubCall.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - Calls a method called [code]_subcall[/code] in this object. - - - [VisualScriptSubCall] will call method named [code]_subcall[/code] in the current script. It will fail if the method doesn't exist or the provided arguments are wrong. - - - - - - - - - Called by this node. - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptSwitch.xml b/modules/visual_script/doc_classes/VisualScriptSwitch.xml deleted file mode 100644 index 9959c0a17..000000000 --- a/modules/visual_script/doc_classes/VisualScriptSwitch.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Branches program flow based on a given input's value. - - - Branches the flow based on an input's value. Use [b]Case Count[/b] in the Inspector to set the number of branches and each comparison's optional type. - [b]Input Ports:[/b] - - Sequence: [code]'input' is[/code] - - Data (variant): [code]=[/code] - - Data (variant): [code]=[/code] (optional) - - Data (variant): [code]input[/code] - [b]Output Ports:[/b] - - Sequence - - Sequence (optional) - - Sequence: [code]done[/code] - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml deleted file mode 100644 index 9a34812a4..000000000 --- a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - A Visual Script node that casts the given value to another type. - - - [VisualScriptTypeCast] will perform a type conversion to an [Object]-derived type. - - - - - - - - The target script class to be converted to. If none, only the [member base_type] will be used. - - - The target type to be converted to. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml deleted file mode 100644 index 04f3a1671..000000000 --- a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Gets a variable's value. - - - Returns a variable's value. "Var Name" must be supplied, with an optional type. - [b]Input Ports:[/b] - none - [b]Output Ports:[/b] - - Data (variant): [code]value[/code] - - - - - - - - The variable's name. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml deleted file mode 100644 index 374ff341b..000000000 --- a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Changes a variable's value. - - - Changes a variable's value to the given input. - [b]Input Ports:[/b] - - Sequence - - Data (variant): [code]set[/code] - [b]Output Ports:[/b] - - Sequence - - - - - - - - The variable's name. - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptWhile.xml b/modules/visual_script/doc_classes/VisualScriptWhile.xml deleted file mode 100644 index d9adc7bf5..000000000 --- a/modules/visual_script/doc_classes/VisualScriptWhile.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Conditional loop. - - - Loops while a condition is [code]true[/code]. Execution continues out the [code]exit[/code] Sequence port when the loop terminates. - [b]Input Ports:[/b] - - Sequence: [code]while(cond)[/code] - - Data (bool): [code]cond[/code] - [b]Output Ports:[/b] - - Sequence: [code]repeat[/code] - - Sequence: [code]exit[/code] - - - - - - - - diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml deleted file mode 100644 index fb880e919..000000000 --- a/modules/visual_script/doc_classes/VisualScriptYield.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - A Visual Script node used to pause a function execution. - - - [VisualScriptYield] will pause the function call and return [VisualScriptFunctionState], which can be used to resume the function. - - - - - - - - The mode to use for yielding. See [enum YieldMode] for available options. - - - The time to wait when [member mode] is set to [constant YIELD_WAIT]. - - - - - Yields during an idle frame. - - - Yields during a physics frame. - - - Yields a function and waits the given time. - - - diff --git a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml deleted file mode 100644 index cf7cf5fc1..000000000 --- a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - A Visual Script node yielding for a signal. - - - [VisualScriptYieldSignal] will pause the function execution until the provided signal is emitted. - - - - - - - - The base type to be used when [member call_mode] is set to [constant CALL_MODE_INSTANCE]. - - - [code]call_mode[/code] determines the target object to wait for the signal emission. See [enum CallMode] for options. - - - The node path to use when [member call_mode] is set to [constant CALL_MODE_NODE_PATH]. - - - The signal name to be waited for. - - - - - A signal from this [Object] will be used. - - - A signal from the given [Node] in the scene tree will be used. - - - A signal from an instanced node with the given type will be used. - - - diff --git a/modules/visual_script/icons/icon_visual_script.svg b/modules/visual_script/icons/icon_visual_script.svg deleted file mode 100644 index f6475d590..000000000 --- a/modules/visual_script/icons/icon_visual_script.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp deleted file mode 100644 index 6b13d2fb3..000000000 --- a/modules/visual_script/register_types.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/*************************************************************************/ -/* register_types.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "register_types.h" - -#include "core/engine.h" -#include "core/io/resource_loader.h" -#include "visual_script.h" -#include "visual_script_builtin_funcs.h" -#include "visual_script_editor.h" -#include "visual_script_expression.h" -#include "visual_script_flow_control.h" -#include "visual_script_func_nodes.h" -#include "visual_script_nodes.h" -#include "visual_script_yield_nodes.h" - -VisualScriptLanguage *visual_script_language = nullptr; -#ifdef TOOLS_ENABLED -static _VisualScriptEditor *vs_editor_singleton = nullptr; -#endif - -void register_visual_script_types() { - visual_script_language = memnew(VisualScriptLanguage); - //script_language_gd->init(); - ScriptServer::register_language(visual_script_language); - - ClassDB::register_class(); - ClassDB::register_virtual_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_virtual_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - //ClassDB::register_type(); - ClassDB::register_class(); - - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - //ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - - ClassDB::register_class(); - ClassDB::register_class(); - - ClassDB::register_class(); - - ClassDB::register_class(); - - register_visual_script_nodes(); - register_visual_script_func_nodes(); - register_visual_script_builtin_func_node(); - register_visual_script_flow_control_nodes(); - register_visual_script_yield_nodes(); - register_visual_script_expression_node(); - -#ifdef TOOLS_ENABLED - ClassDB::set_current_api(ClassDB::API_EDITOR); - ClassDB::register_class<_VisualScriptEditor>(); - ClassDB::set_current_api(ClassDB::API_CORE); - vs_editor_singleton = memnew(_VisualScriptEditor); - Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton())); - - VisualScriptEditor::register_editor(); -#endif -} - -void unregister_visual_script_types() { - unregister_visual_script_nodes(); - - ScriptServer::unregister_language(visual_script_language); - -#ifdef TOOLS_ENABLED - VisualScriptEditor::free_clipboard(); - if (vs_editor_singleton) { - memdelete(vs_editor_singleton); - } -#endif - if (visual_script_language) { - memdelete(visual_script_language); - } -} diff --git a/modules/visual_script/register_types.h b/modules/visual_script/register_types.h deleted file mode 100644 index 29768da67..000000000 --- a/modules/visual_script/register_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************/ -/* register_types.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef VISUAL_SCRIPT_REGISTER_TYPES_H -#define VISUAL_SCRIPT_REGISTER_TYPES_H - -void register_visual_script_types(); -void unregister_visual_script_types(); - -#endif // VISUAL_SCRIPT_REGISTER_TYPES_H diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp deleted file mode 100644 index ab2a12bcb..000000000 --- a/modules/visual_script/visual_script.cpp +++ /dev/null @@ -1,2595 +0,0 @@ -/*************************************************************************/ -/* visual_script.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "visual_script.h" - -#include "core/core_string_names.h" -#include "core/os/os.h" -#include "core/project_settings.h" -#include "scene/main/node.h" -#include "visual_script_nodes.h" - -//used by editor, this is not really saved -void VisualScriptNode::set_breakpoint(bool p_breakpoint) { - breakpoint = p_breakpoint; -} - -bool VisualScriptNode::is_breakpoint() const { - return breakpoint; -} - -void VisualScriptNode::ports_changed_notify() { - emit_signal("ports_changed"); -} - -void VisualScriptNode::set_default_input_value(int p_port, const Variant &p_value) { - ERR_FAIL_INDEX(p_port, default_input_values.size()); - - default_input_values[p_port] = p_value; - -#ifdef TOOLS_ENABLED - for (Set::Element *E = scripts_used.front(); E; E = E->next()) { - E->get()->set_edited(true); - } -#endif -} - -Variant VisualScriptNode::get_default_input_value(int p_port) const { - ERR_FAIL_INDEX_V(p_port, default_input_values.size(), Variant()); - return default_input_values[p_port]; -} - -void VisualScriptNode::_set_default_input_values(Array p_values) { - default_input_values = p_values; -} - -void VisualScriptNode::validate_input_default_values() { - default_input_values.resize(MAX(default_input_values.size(), get_input_value_port_count())); //let it grow as big as possible, we don't want to lose values on resize - - //actually validate on save - for (int i = 0; i < get_input_value_port_count(); i++) { - Variant::Type expected = get_input_value_port_info(i).type; - - if (expected == Variant::NIL || expected == default_input_values[i].get_type()) { - continue; - } else { - //not the same, reconvert - Variant::CallError ce; - Variant existing = default_input_values[i]; - const Variant *existingp = &existing; - default_input_values[i] = Variant::construct(expected, &existingp, 1, ce, false); - if (ce.error != Variant::CallError::CALL_OK) { - //could not convert? force.. - default_input_values[i] = Variant::construct(expected, nullptr, 0, ce, false); - } - } - } -} - -Array VisualScriptNode::_get_default_input_values() const { - //validate on save, since on load there is little info about this - Array values = default_input_values; - values.resize(get_input_value_port_count()); - - return values; -} - -String VisualScriptNode::get_text() const { - return ""; -} - -void VisualScriptNode::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script); - ClassDB::bind_method(D_METHOD("set_default_input_value", "port_idx", "value"), &VisualScriptNode::set_default_input_value); - ClassDB::bind_method(D_METHOD("get_default_input_value", "port_idx"), &VisualScriptNode::get_default_input_value); - ClassDB::bind_method(D_METHOD("ports_changed_notify"), &VisualScriptNode::ports_changed_notify); - ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualScriptNode::_set_default_input_values); - ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualScriptNode::_get_default_input_values); - - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_default_input_values", "_get_default_input_values"); - ADD_SIGNAL(MethodInfo("ports_changed")); -} - -VisualScriptNode::TypeGuess VisualScriptNode::guess_output_type(TypeGuess *p_inputs, int p_output) const { - PropertyInfo pinfo = get_output_value_port_info(p_output); - - TypeGuess tg; - - tg.type = pinfo.type; - if (pinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) { - tg.gdclass = pinfo.hint_string; - } - - return tg; -} - -Ref VisualScriptNode::get_visual_script() const { - if (scripts_used.size()) { - return Ref(scripts_used.front()->get()); - } - - return Ref(); -} - -VisualScriptNode::VisualScriptNode() { - breakpoint = false; -} - -//////////////// - -///////////////////// - -VisualScriptNodeInstance::VisualScriptNodeInstance() { - sequence_outputs = nullptr; - input_ports = nullptr; -} - -VisualScriptNodeInstance::~VisualScriptNodeInstance() { - if (sequence_outputs) { - memdelete_arr(sequence_outputs); - } - - if (input_ports) { - memdelete_arr(input_ports); - } - - if (output_ports) { - memdelete_arr(output_ports); - } -} - -void VisualScript::add_function(const StringName &p_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!String(p_name).is_valid_identifier()); - ERR_FAIL_COND(functions.has(p_name)); - - functions[p_name] = Function(); - functions[p_name].scroll = Vector2(-50, -100); -} - -bool VisualScript::has_function(const StringName &p_name) const { - return functions.has(p_name); -} -void VisualScript::remove_function(const StringName &p_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_name)); - - for (Map::Element *E = functions[p_name].nodes.front(); E; E = E->next()) { - E->get().node->disconnect("ports_changed", this, "_node_ports_changed"); - E->get().node->scripts_used.erase(this); - } - - functions.erase(p_name); -} - -void VisualScript::rename_function(const StringName &p_name, const StringName &p_new_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_name)); - if (p_new_name == p_name) { - return; - } - - ERR_FAIL_COND(!String(p_new_name).is_valid_identifier()); - - ERR_FAIL_COND(functions.has(p_new_name)); - ERR_FAIL_COND(variables.has(p_new_name)); - ERR_FAIL_COND(custom_signals.has(p_new_name)); - - functions[p_new_name] = functions[p_name]; - functions.erase(p_name); -} - -void VisualScript::set_function_scroll(const StringName &p_name, const Vector2 &p_scroll) { - ERR_FAIL_COND(!functions.has(p_name)); - functions[p_name].scroll = p_scroll; -} - -Vector2 VisualScript::get_function_scroll(const StringName &p_name) const { - ERR_FAIL_COND_V(!functions.has(p_name), Vector2()); - return functions[p_name].scroll; -} - -void VisualScript::get_function_list(List *r_functions) const { - for (const Map::Element *E = functions.front(); E; E = E->next()) { - r_functions->push_back(E->key()); - } - - r_functions->sort_custom(); -} - -int VisualScript::get_function_node_id(const StringName &p_name) const { - ERR_FAIL_COND_V(!functions.has(p_name), -1); - - return functions[p_name].function_id; -} - -void VisualScript::_node_ports_changed(int p_id) { - StringName function; - - for (Map::Element *E = functions.front(); E; E = E->next()) { - if (E->get().nodes.has(p_id)) { - function = E->key(); - break; - } - } - - ERR_FAIL_COND(function == StringName()); - - Function &func = functions[function]; - Ref vsn = func.nodes[p_id].node; - - vsn->validate_input_default_values(); - - //must revalidate all the functions - - { - List to_remove; - - for (Set::Element *E = func.sequence_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id && E->get().from_output >= vsn->get_output_sequence_port_count()) { - to_remove.push_back(E->get()); - } - if (E->get().to_node == p_id && !vsn->has_input_sequence_port()) { - to_remove.push_back(E->get()); - } - } - - while (to_remove.size()) { - func.sequence_connections.erase(to_remove.front()->get()); - to_remove.pop_front(); - } - } - - { - List to_remove; - - for (Set::Element *E = func.data_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id && E->get().from_port >= vsn->get_output_value_port_count()) { - to_remove.push_back(E->get()); - } - if (E->get().to_node == p_id && E->get().to_port >= vsn->get_input_value_port_count()) { - to_remove.push_back(E->get()); - } - } - - while (to_remove.size()) { - func.data_connections.erase(to_remove.front()->get()); - to_remove.pop_front(); - } - } - -#ifdef TOOLS_ENABLED - set_edited(true); //something changed, let's set as edited - emit_signal("node_ports_changed", function, p_id); -#endif -} - -void VisualScript::add_node(const StringName &p_func, int p_id, const Ref &p_node, const Point2 &p_pos) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_func)); - ERR_FAIL_COND(p_node.is_null()); - - for (Map::Element *E = functions.front(); E; E = E->next()) { - ERR_FAIL_COND(E->get().nodes.has(p_id)); //id can exist only one in script, even for different functions - } - - Function &func = functions[p_func]; - - if (Object::cast_to(*p_node)) { - //the function indeed - ERR_FAIL_COND_MSG(func.function_id >= 0, "A function node has already been set here."); - - func.function_id = p_id; - } - - Function::NodeData nd; - nd.node = p_node; - nd.pos = p_pos; - - Ref vsn = p_node; - vsn->connect("ports_changed", this, "_node_ports_changed", varray(p_id)); - vsn->scripts_used.insert(this); - vsn->validate_input_default_values(); // Validate when fully loaded - - func.nodes[p_id] = nd; -} - -void VisualScript::remove_node(const StringName &p_func, int p_id) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_func)); - Function &func = functions[p_func]; - - ERR_FAIL_COND(!func.nodes.has(p_id)); - { - List to_remove; - - for (Set::Element *E = func.sequence_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id || E->get().to_node == p_id) { - to_remove.push_back(E->get()); - } - } - - while (to_remove.size()) { - func.sequence_connections.erase(to_remove.front()->get()); - to_remove.pop_front(); - } - } - - { - List to_remove; - - for (Set::Element *E = func.data_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id || E->get().to_node == p_id) { - to_remove.push_back(E->get()); - } - } - - while (to_remove.size()) { - func.data_connections.erase(to_remove.front()->get()); - to_remove.pop_front(); - } - } - - if (Object::cast_to(func.nodes[p_id].node.ptr())) { - func.function_id = -1; //revert to invalid - } - - func.nodes[p_id].node->disconnect("ports_changed", this, "_node_ports_changed"); - func.nodes[p_id].node->scripts_used.erase(this); - - func.nodes.erase(p_id); -} - -bool VisualScript::has_node(const StringName &p_func, int p_id) const { - ERR_FAIL_COND_V(!functions.has(p_func), false); - const Function &func = functions[p_func]; - - return func.nodes.has(p_id); -} - -Ref VisualScript::get_node(const StringName &p_func, int p_id) const { - ERR_FAIL_COND_V(!functions.has(p_func), Ref()); - const Function &func = functions[p_func]; - - ERR_FAIL_COND_V(!func.nodes.has(p_id), Ref()); - - return func.nodes[p_id].node; -} - -void VisualScript::set_node_position(const StringName &p_func, int p_id, const Point2 &p_pos) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_func)); - Function &func = functions[p_func]; - - ERR_FAIL_COND(!func.nodes.has(p_id)); - func.nodes[p_id].pos = p_pos; -} - -Point2 VisualScript::get_node_position(const StringName &p_func, int p_id) const { - ERR_FAIL_COND_V(!functions.has(p_func), Point2()); - const Function &func = functions[p_func]; - - ERR_FAIL_COND_V(!func.nodes.has(p_id), Point2()); - return func.nodes[p_id].pos; -} - -void VisualScript::get_node_list(const StringName &p_func, List *r_nodes) const { - ERR_FAIL_COND(!functions.has(p_func)); - const Function &func = functions[p_func]; - - for (const Map::Element *E = func.nodes.front(); E; E = E->next()) { - r_nodes->push_back(E->key()); - } -} - -void VisualScript::sequence_connect(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_func)); - Function &func = functions[p_func]; - - SequenceConnection sc; - sc.from_node = p_from_node; - sc.from_output = p_from_output; - sc.to_node = p_to_node; - ERR_FAIL_COND(func.sequence_connections.has(sc)); - - func.sequence_connections.insert(sc); -} - -void VisualScript::sequence_disconnect(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node) { - ERR_FAIL_COND(!functions.has(p_func)); - Function &func = functions[p_func]; - - SequenceConnection sc; - sc.from_node = p_from_node; - sc.from_output = p_from_output; - sc.to_node = p_to_node; - ERR_FAIL_COND(!func.sequence_connections.has(sc)); - - func.sequence_connections.erase(sc); -} - -bool VisualScript::has_sequence_connection(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node) const { - ERR_FAIL_COND_V(!functions.has(p_func), false); - const Function &func = functions[p_func]; - - SequenceConnection sc; - sc.from_node = p_from_node; - sc.from_output = p_from_output; - sc.to_node = p_to_node; - - return func.sequence_connections.has(sc); -} - -void VisualScript::get_sequence_connection_list(const StringName &p_func, List *r_connection) const { - ERR_FAIL_COND(!functions.has(p_func)); - const Function &func = functions[p_func]; - - for (const Set::Element *E = func.sequence_connections.front(); E; E = E->next()) { - r_connection->push_back(E->get()); - } -} - -void VisualScript::data_connect(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!functions.has(p_func)); - Function &func = functions[p_func]; - - DataConnection dc; - dc.from_node = p_from_node; - dc.from_port = p_from_port; - dc.to_node = p_to_node; - dc.to_port = p_to_port; - - ERR_FAIL_COND(func.data_connections.has(dc)); - - func.data_connections.insert(dc); -} - -void VisualScript::data_disconnect(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) { - ERR_FAIL_COND(!functions.has(p_func)); - Function &func = functions[p_func]; - - DataConnection dc; - dc.from_node = p_from_node; - dc.from_port = p_from_port; - dc.to_node = p_to_node; - dc.to_port = p_to_port; - - ERR_FAIL_COND(!func.data_connections.has(dc)); - - func.data_connections.erase(dc); -} - -bool VisualScript::has_data_connection(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) const { - ERR_FAIL_COND_V(!functions.has(p_func), false); - const Function &func = functions[p_func]; - - DataConnection dc; - dc.from_node = p_from_node; - dc.from_port = p_from_port; - dc.to_node = p_to_node; - dc.to_port = p_to_port; - - return func.data_connections.has(dc); -} - -bool VisualScript::is_input_value_port_connected(const StringName &p_func, int p_node, int p_port) const { - ERR_FAIL_COND_V(!functions.has(p_func), false); - const Function &func = functions[p_func]; - - for (const Set::Element *E = func.data_connections.front(); E; E = E->next()) { - if (E->get().to_node == p_node && E->get().to_port == p_port) { - return true; - } - } - - return false; -} - -bool VisualScript::get_input_value_port_connection_source(const StringName &p_func, int p_node, int p_port, int *r_node, int *r_port) const { - ERR_FAIL_COND_V(!functions.has(p_func), false); - const Function &func = functions[p_func]; - - for (const Set::Element *E = func.data_connections.front(); E; E = E->next()) { - if (E->get().to_node == p_node && E->get().to_port == p_port) { - *r_node = E->get().from_node; - *r_port = E->get().from_port; - return true; - } - } - - return false; -} - -void VisualScript::get_data_connection_list(const StringName &p_func, List *r_connection) const { - ERR_FAIL_COND(!functions.has(p_func)); - const Function &func = functions[p_func]; - - for (const Set::Element *E = func.data_connections.front(); E; E = E->next()) { - r_connection->push_back(E->get()); - } -} - -void VisualScript::set_tool_enabled(bool p_enabled) { - is_tool_script = p_enabled; -} - -void VisualScript::add_variable(const StringName &p_name, const Variant &p_default_value, bool p_export) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!String(p_name).is_valid_identifier()); - ERR_FAIL_COND(variables.has(p_name)); - - Variable v; - v.default_value = p_default_value; - v.info.type = p_default_value.get_type(); - v.info.name = p_name; - v.info.hint = PROPERTY_HINT_NONE; - v._export = p_export; - - variables[p_name] = v; - -#ifdef TOOLS_ENABLED - _update_placeholders(); -#endif -} - -bool VisualScript::has_variable(const StringName &p_name) const { - return variables.has(p_name); -} - -void VisualScript::remove_variable(const StringName &p_name) { - ERR_FAIL_COND(!variables.has(p_name)); - variables.erase(p_name); - -#ifdef TOOLS_ENABLED - _update_placeholders(); -#endif -} - -void VisualScript::set_variable_default_value(const StringName &p_name, const Variant &p_value) { - ERR_FAIL_COND(!variables.has(p_name)); - - variables[p_name].default_value = p_value; - -#ifdef TOOLS_ENABLED - _update_placeholders(); -#endif -} -Variant VisualScript::get_variable_default_value(const StringName &p_name) const { - ERR_FAIL_COND_V(!variables.has(p_name), Variant()); - return variables[p_name].default_value; -} -void VisualScript::set_variable_info(const StringName &p_name, const PropertyInfo &p_info) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!variables.has(p_name)); - variables[p_name].info = p_info; - variables[p_name].info.name = p_name; - -#ifdef TOOLS_ENABLED - _update_placeholders(); -#endif -} -PropertyInfo VisualScript::get_variable_info(const StringName &p_name) const { - ERR_FAIL_COND_V(!variables.has(p_name), PropertyInfo()); - return variables[p_name].info; -} - -void VisualScript::set_variable_export(const StringName &p_name, bool p_export) { - ERR_FAIL_COND(!variables.has(p_name)); - - variables[p_name]._export = p_export; -#ifdef TOOLS_ENABLED - _update_placeholders(); -#endif -} - -bool VisualScript::get_variable_export(const StringName &p_name) const { - ERR_FAIL_COND_V(!variables.has(p_name), false); - return variables[p_name]._export; -} - -void VisualScript::_set_variable_info(const StringName &p_name, const Dictionary &p_info) { - PropertyInfo pinfo; - if (p_info.has("type")) { - pinfo.type = Variant::Type(int(p_info["type"])); - } - if (p_info.has("name")) { - pinfo.name = p_info["name"]; - } - if (p_info.has("hint")) { - pinfo.hint = PropertyHint(int(p_info["hint"])); - } - if (p_info.has("hint_string")) { - pinfo.hint_string = p_info["hint_string"]; - } - if (p_info.has("usage")) { - pinfo.usage = p_info["usage"]; - } - - set_variable_info(p_name, pinfo); -} - -Dictionary VisualScript::_get_variable_info(const StringName &p_name) const { - PropertyInfo pinfo = get_variable_info(p_name); - Dictionary d; - d["type"] = pinfo.type; - d["name"] = pinfo.name; - d["hint"] = pinfo.hint; - d["hint_string"] = pinfo.hint_string; - d["usage"] = pinfo.usage; - - return d; -} - -void VisualScript::get_variable_list(List *r_variables) const { - for (Map::Element *E = variables.front(); E; E = E->next()) { - r_variables->push_back(E->key()); - } - - r_variables->sort_custom(); -} - -void VisualScript::set_instance_base_type(const StringName &p_type) { - ERR_FAIL_COND(instances.size()); - base_type = p_type; -} - -void VisualScript::rename_variable(const StringName &p_name, const StringName &p_new_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!variables.has(p_name)); - if (p_new_name == p_name) { - return; - } - - ERR_FAIL_COND(!String(p_new_name).is_valid_identifier()); - - ERR_FAIL_COND(functions.has(p_new_name)); - ERR_FAIL_COND(variables.has(p_new_name)); - ERR_FAIL_COND(custom_signals.has(p_new_name)); - - variables[p_new_name] = variables[p_name]; - variables.erase(p_name); -} - -void VisualScript::add_custom_signal(const StringName &p_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!String(p_name).is_valid_identifier()); - ERR_FAIL_COND(custom_signals.has(p_name)); - - custom_signals[p_name] = Vector(); -} - -bool VisualScript::has_custom_signal(const StringName &p_name) const { - return custom_signals.has(p_name); -} -void VisualScript::custom_signal_add_argument(const StringName &p_func, Variant::Type p_type, const String &p_name, int p_index) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_func)); - Argument arg; - arg.type = p_type; - arg.name = p_name; - if (p_index < 0) { - custom_signals[p_func].push_back(arg); - } else { - custom_signals[p_func].insert(0, arg); - } -} -void VisualScript::custom_signal_set_argument_type(const StringName &p_func, int p_argidx, Variant::Type p_type) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_func)); - ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size()); - custom_signals[p_func].write[p_argidx].type = p_type; -} -Variant::Type VisualScript::custom_signal_get_argument_type(const StringName &p_func, int p_argidx) const { - ERR_FAIL_COND_V(!custom_signals.has(p_func), Variant::NIL); - ERR_FAIL_INDEX_V(p_argidx, custom_signals[p_func].size(), Variant::NIL); - return custom_signals[p_func][p_argidx].type; -} -void VisualScript::custom_signal_set_argument_name(const StringName &p_func, int p_argidx, const String &p_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_func)); - ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size()); - custom_signals[p_func].write[p_argidx].name = p_name; -} -String VisualScript::custom_signal_get_argument_name(const StringName &p_func, int p_argidx) const { - ERR_FAIL_COND_V(!custom_signals.has(p_func), String()); - ERR_FAIL_INDEX_V(p_argidx, custom_signals[p_func].size(), String()); - return custom_signals[p_func][p_argidx].name; -} -void VisualScript::custom_signal_remove_argument(const StringName &p_func, int p_argidx) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_func)); - ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size()); - custom_signals[p_func].remove(p_argidx); -} - -int VisualScript::custom_signal_get_argument_count(const StringName &p_func) const { - ERR_FAIL_COND_V(!custom_signals.has(p_func), 0); - return custom_signals[p_func].size(); -} -void VisualScript::custom_signal_swap_argument(const StringName &p_func, int p_argidx, int p_with_argidx) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_func)); - ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size()); - ERR_FAIL_INDEX(p_with_argidx, custom_signals[p_func].size()); - - SWAP(custom_signals[p_func].write[p_argidx], custom_signals[p_func].write[p_with_argidx]); -} -void VisualScript::remove_custom_signal(const StringName &p_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_name)); - custom_signals.erase(p_name); -} - -void VisualScript::rename_custom_signal(const StringName &p_name, const StringName &p_new_name) { - ERR_FAIL_COND(instances.size()); - ERR_FAIL_COND(!custom_signals.has(p_name)); - if (p_new_name == p_name) { - return; - } - - ERR_FAIL_COND(!String(p_new_name).is_valid_identifier()); - - ERR_FAIL_COND(functions.has(p_new_name)); - ERR_FAIL_COND(variables.has(p_new_name)); - ERR_FAIL_COND(custom_signals.has(p_new_name)); - - custom_signals[p_new_name] = custom_signals[p_name]; - custom_signals.erase(p_name); -} - -void VisualScript::get_custom_signal_list(List *r_custom_signals) const { - for (const Map>::Element *E = custom_signals.front(); E; E = E->next()) { - r_custom_signals->push_back(E->key()); - } - - r_custom_signals->sort_custom(); -} - -int VisualScript::get_available_id() const { - int max_id = 0; - for (Map::Element *E = functions.front(); E; E = E->next()) { - if (E->get().nodes.empty()) { - continue; - } - - int last_id = E->get().nodes.back()->key(); - max_id = MAX(max_id, last_id + 1); - } - - return max_id; -} - -///////////////////////////////// - -bool VisualScript::can_instance() const { - return true; //ScriptServer::is_scripting_enabled(); -} - -StringName VisualScript::get_instance_base_type() const { - return base_type; -} - -Ref