diff options
Diffstat (limited to 'modules/visual_script')
57 files changed, 3276 insertions, 30 deletions
diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py index 5698a37295..6b1ce41014 100644 --- a/modules/visual_script/config.py +++ b/modules/visual_script/config.py @@ -1,8 +1,57 @@ - - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "VisualScriptBasicTypeConstant", + "VisualScriptBuiltinFunc", + "VisualScriptClassConstant", + "VisualScriptComment", + "VisualScriptCondition", + "VisualScriptConstant", + "VisualScriptConstructor", + "VisualScriptCustomNode", + "VisualScriptDeconstruct", + "VisualScriptEditor", + "VisualScriptEmitSignal", + "VisualScriptEngineSingleton", + "VisualScriptExpression", + "VisualScriptFunctionCall", + "VisualScriptFunctionState", + "VisualScriptFunction", + "VisualScriptGlobalConstant", + "VisualScriptIndexGet", + "VisualScriptIndexSet", + "VisualScriptInputAction", + "VisualScriptIterator", + "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 new file mode 100644 index 0000000000..80b1ed86d7 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScript.xml @@ -0,0 +1,515 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScript" inherits="Script" category="Core" version="3.0-alpha"> + <brief_description> + A script implemented in the Visual Script programming environment. + </brief_description> + <description> + 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. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="add_custom_signal"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Add a custom signal with the specified name to the VisualScript. + </description> + </method> + <method name="add_function"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Add a function with the specified name to the VisualScript. + </description> + </method> + <method name="add_node"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="node" type="VisualScriptNode"> + </argument> + <argument index="3" name="position" type="Vector2" default="Vector2( 0, 0 )"> + </argument> + <description> + Add a node to a function of the VisualScript. + </description> + </method> + <method name="add_variable"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="default_value" type="Variant" default="null"> + </argument> + <argument index="2" name="export" type="bool" default="false"> + </argument> + <description> + Add a variable to the VisualScript, optionally giving it a default value or marking it as exported. + </description> + </method> + <method name="custom_signal_add_argument"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="type" type="int" enum="Variant.Type"> + </argument> + <argument index="2" name="argname" type="String"> + </argument> + <argument index="3" name="index" type="int" default="-1"> + </argument> + <description> + Add an argument to a custom signal added with [method add_custom_signal]. + </description> + </method> + <method name="custom_signal_get_argument_count" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Get the count of a custom signal's arguments. + </description> + </method> + <method name="custom_signal_get_argument_name" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="argidx" type="int"> + </argument> + <description> + Get the name of a custom signal's argument. + </description> + </method> + <method name="custom_signal_get_argument_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="argidx" type="int"> + </argument> + <description> + Get the type of a custom signal's argument. + </description> + </method> + <method name="custom_signal_remove_argument"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="argidx" type="int"> + </argument> + <description> + Remove a specific custom signal's argument. + </description> + </method> + <method name="custom_signal_set_argument_name"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="argidx" type="int"> + </argument> + <argument index="2" name="argname" type="String"> + </argument> + <description> + Rename a custom signal's argument. + </description> + </method> + <method name="custom_signal_set_argument_type"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="argidx" type="int"> + </argument> + <argument index="2" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + Change the type of a custom signal's argument. + </description> + </method> + <method name="custom_signal_swap_argument"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="argidx" type="int"> + </argument> + <argument index="2" name="withidx" type="int"> + </argument> + <description> + Swap two of the arguments of a custom signal. + </description> + </method> + <method name="data_connect"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="from_node" type="int"> + </argument> + <argument index="2" name="from_port" type="int"> + </argument> + <argument index="3" name="to_node" type="int"> + </argument> + <argument index="4" name="to_port" type="int"> + </argument> + <description> + 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]. + </description> + </method> + <method name="data_disconnect"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="from_node" type="int"> + </argument> + <argument index="2" name="from_port" type="int"> + </argument> + <argument index="3" name="to_node" type="int"> + </argument> + <argument index="4" name="to_port" type="int"> + </argument> + <description> + Disconnect two data ports previously connected with [method data_connect]. + </description> + </method> + <method name="get_function_node_id" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns the id of a function's entry point node. + </description> + </method> + <method name="get_function_scroll" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns the position of the center of the screen for a given function. + </description> + </method> + <method name="get_node" qualifiers="const"> + <return type="VisualScriptNode"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + Returns a node given its id and its function. + </description> + </method> + <method name="get_node_position" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + Returns a node's position in pixels. + </description> + </method> + <method name="get_variable_default_value" qualifiers="const"> + <return type="Variant"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns the default (initial) value of a variable. + </description> + </method> + <method name="get_variable_export" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns whether a variable is exported. + </description> + </method> + <method name="get_variable_info" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns the info for a given variable as a dictionary. The information includes its name, type, hint and usage. + </description> + </method> + <method name="has_custom_signal" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns whether a signal exists with the specified name. + </description> + </method> + <method name="has_data_connection" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="from_node" type="int"> + </argument> + <argument index="2" name="from_port" type="int"> + </argument> + <argument index="3" name="to_node" type="int"> + </argument> + <argument index="4" name="to_port" type="int"> + </argument> + <description> + Returns whether the specified data ports are connected. + </description> + </method> + <method name="has_function" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns whether a function exists with the specified name. + </description> + </method> + <method name="has_node" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + Returns whether a node exists with the given id. + </description> + </method> + <method name="has_sequence_connection" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="from_node" type="int"> + </argument> + <argument index="2" name="from_output" type="int"> + </argument> + <argument index="3" name="to_node" type="int"> + </argument> + <description> + Returns whether the specified sequence ports are connected. + </description> + </method> + <method name="has_variable" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Returns whether a variable exists with the specified name. + </description> + </method> + <method name="remove_custom_signal"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Remove a custom signal with the given name. + </description> + </method> + <method name="remove_function"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Remove a specific function and its nodes from the script. + </description> + </method> + <method name="remove_node"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + Remove a specific node. + </description> + </method> + <method name="remove_variable"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Remove a variable with the given name. + </description> + </method> + <method name="rename_custom_signal"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="new_name" type="String"> + </argument> + <description> + Change the name of a custom signal. + </description> + </method> + <method name="rename_function"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="new_name" type="String"> + </argument> + <description> + Change the name of a function. + </description> + </method> + <method name="rename_variable"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="new_name" type="String"> + </argument> + <description> + Change the name of a variable. + </description> + </method> + <method name="sequence_connect"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="from_node" type="int"> + </argument> + <argument index="2" name="from_output" type="int"> + </argument> + <argument index="3" name="to_node" type="int"> + </argument> + <description> + 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. + </description> + </method> + <method name="sequence_disconnect"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="from_node" type="int"> + </argument> + <argument index="2" name="from_output" type="int"> + </argument> + <argument index="3" name="to_node" type="int"> + </argument> + <description> + Disconnect two sequence ports previously connected with [method sequence_connect]. + </description> + </method> + <method name="set_function_scroll"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="ofs" type="Vector2"> + </argument> + <description> + Position the center of the screen for a function. + </description> + </method> + <method name="set_instance_base_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="String"> + </argument> + <description> + Set the base type of the script. + </description> + </method> + <method name="set_node_position"> + <return type="void"> + </return> + <argument index="0" name="func" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="position" type="Vector2"> + </argument> + <description> + Position a node on the screen. + </description> + </method> + <method name="set_variable_default_value"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="value" type="Variant"> + </argument> + <description> + Change the default (initial) value of a variable. + </description> + </method> + <method name="set_variable_export"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="enable" type="bool"> + </argument> + <description> + Change whether a variable is exported. + </description> + </method> + <method name="set_variable_info"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="value" type="Dictionary"> + </argument> + <description> + Set a variable's info, using the same format as [method get_variable_info]. + </description> + </method> + </methods> + <members> + <member name="data" type="Dictionary" setter="_set_data" getter="_get_data"> + </member> + </members> + <signals> + <signal name="node_ports_changed"> + <argument index="0" name="function" type="String"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + Emitted when the ports of a node are changed. + </description> + </signal> + </signals> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml new file mode 100644 index 0000000000..6c028e5f28 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node representing a constant from the base types. + </brief_description> + <description> + A Visual Script node representing a constant from base types, such as [Vector3.AXIS_X]. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_basic_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="get_basic_type_constant" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_basic_type"> + <return type="void"> + </return> + <argument index="0" name="name" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + <method name="set_basic_type_constant"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> + The type to get the constant from. + </member> + <member name="constant" type="String" setter="set_basic_type_constant" getter="get_basic_type_constant"> + The name of the constant to return. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml new file mode 100644 index 0000000000..27231574d7 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node used to call built-in functions. + </brief_description> + <description> + 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. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_func"> + <return type="int" enum="VisualScriptBuiltinFunc.BuiltinFunc"> + </return> + <description> + </description> + </method> + <method name="set_func"> + <return type="void"> + </return> + <argument index="0" name="which" type="int" enum="VisualScriptBuiltinFunc.BuiltinFunc"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="function" type="int" setter="set_func" getter="get_func" enum="VisualScriptBuiltinFunc.BuiltinFunc"> + The function to be executed. + </member> + </members> + <constants> + <constant name="MATH_SIN" value="0"> + Return the sine of the input. + </constant> + <constant name="MATH_COS" value="1"> + Return the cosine of the input. + </constant> + <constant name="MATH_TAN" value="2"> + Return the tangent of the input. + </constant> + <constant name="MATH_SINH" value="3"> + Return the hyperbolic sine of the input. + </constant> + <constant name="MATH_COSH" value="4"> + Return the hyperbolic cosine of the input. + </constant> + <constant name="MATH_TANH" value="5"> + Return the hyperbolic tangent of the input. + </constant> + <constant name="MATH_ASIN" value="6"> + Return the arc sine of the input. + </constant> + <constant name="MATH_ACOS" value="7"> + Return the arc cosine of the input. + </constant> + <constant name="MATH_ATAN" value="8"> + Return the arc tangent of the input. + </constant> + <constant name="MATH_ATAN2" value="9"> + Return the arc tangent of the input, using the signs of both parameters to determine the exact angle. + </constant> + <constant name="MATH_SQRT" value="10"> + Return the square root of the input. + </constant> + <constant name="MATH_FMOD" value="11"> + Return the remainder of one input divided by the other, using floating-point numbers. + </constant> + <constant name="MATH_FPOSMOD" value="12"> + Return the positive remainder of one input divided by the other, using floating-point numbers. + </constant> + <constant name="MATH_FLOOR" value="13"> + Return the input rounded down. + </constant> + <constant name="MATH_CEIL" value="14"> + Return the input rounded up. + </constant> + <constant name="MATH_ROUND" value="15"> + Return the input rounded to the nearest integer. + </constant> + <constant name="MATH_ABS" value="16"> + Return the absolute value of the input. + </constant> + <constant name="MATH_SIGN" value="17"> + Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative. + </constant> + <constant name="MATH_POW" value="18"> + Return the input raised to a given power. + </constant> + <constant name="MATH_LOG" value="19"> + Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use. + </constant> + <constant name="MATH_EXP" value="20"> + 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. + </constant> + <constant name="MATH_ISNAN" value="21"> + Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist. + </constant> + <constant name="MATH_ISINF" value="22"> + 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. + </constant> + <constant name="MATH_EASE" value="23"> + 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. + </constant> + <constant name="MATH_DECIMALS" value="24"> + Return the number of digit places after the decimal that the first non-zero digit occurs. + </constant> + <constant name="MATH_STEPIFY" value="25"> + Return the input snapped to a given step. + </constant> + <constant name="MATH_LERP" value="26"> + Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula [code]a + (a - b) * t[/code]. + </constant> + <constant name="MATH_INVERSE_LERP" value="27"> + </constant> + <constant name="MATH_RANGE_LERP" value="28"> + </constant> + <constant name="MATH_DECTIME" value="29"> + Return the result of 'value' decreased by 'step' * 'amount'. + </constant> + <constant name="MATH_RANDOMIZE" value="30"> + Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time. + </constant> + <constant name="MATH_RAND" value="31"> + 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. + </constant> + <constant name="MATH_RANDF" value="32"> + 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. + </constant> + <constant name="MATH_RANDOM" value="33"> + Return a random floating-point value between the two inputs. + </constant> + <constant name="MATH_SEED" value="34"> + Set the seed for the random number generator. + </constant> + <constant name="MATH_RANDSEED" value="35"> + Return a random value from the given seed, along with the new seed. + </constant> + <constant name="MATH_DEG2RAD" value="36"> + Convert the input from degrees to radians. + </constant> + <constant name="MATH_RAD2DEG" value="37"> + Convert the input from radians to degrees. + </constant> + <constant name="MATH_LINEAR2DB" value="38"> + Convert the input from linear volume to decibel volume. + </constant> + <constant name="MATH_DB2LINEAR" value="39"> + Convert the input from decibel volume to linear volume. + </constant> + <constant name="MATH_WRAP" value="40"> + </constant> + <constant name="MATH_WRAPF" value="41"> + </constant> + <constant name="LOGIC_MAX" value="42"> + Return the greater of the two numbers, also known as their maximum. + </constant> + <constant name="LOGIC_MIN" value="43"> + Return the lesser of the two numbers, also known as their minimum. + </constant> + <constant name="LOGIC_CLAMP" value="44"> + Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to `min(max(input, range_low), range_high)` + </constant> + <constant name="LOGIC_NEAREST_PO2" value="45"> + Return the nearest power of 2 to the input. + </constant> + <constant name="OBJ_WEAKREF" value="46"> + Create a [WeakRef] from the input. + </constant> + <constant name="FUNC_FUNCREF" value="47"> + Create a [FuncRef] from the input. + </constant> + <constant name="TYPE_CONVERT" value="48"> + Convert between types. + </constant> + <constant name="TYPE_OF" value="49"> + Return the type of the input as an integer. Check [enum Variant.Type] for the integers that might be returned. + </constant> + <constant name="TYPE_EXISTS" value="50"> + Checks if a type is registered in the [ClassDB]. + </constant> + <constant name="TEXT_CHAR" value="51"> + Return a character with the given ascii value. + </constant> + <constant name="TEXT_STR" value="52"> + Convert the input to a string. + </constant> + <constant name="TEXT_PRINT" value="53"> + Print the given string to the output window. + </constant> + <constant name="TEXT_PRINTERR" value="54"> + Print the given string to the standard error output. + </constant> + <constant name="TEXT_PRINTRAW" value="55"> + Print the given string to the standard output, without adding a newline. + </constant> + <constant name="VAR_TO_STR" value="56"> + Serialize a [Variant] to a string. + </constant> + <constant name="STR_TO_VAR" value="57"> + Deserialize a [Variant] from a string serialized using [VAR_TO_STR]. + </constant> + <constant name="VAR_TO_BYTES" value="58"> + Serialize a [Variant] to a [PoolByteArray]. + </constant> + <constant name="BYTES_TO_VAR" value="59"> + Deserialize a [Variant] from a [PoolByteArray] serialized using [VAR_TO_BYTES]. + </constant> + <constant name="COLORN" value="60"> + Return the [Color] with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc. + </constant> + <constant name="FUNC_MAX" value="61"> + The maximum value the [member function] property can have. + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml new file mode 100644 index 0000000000..e6498e92ad --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Gets a constant from a given class. + </brief_description> + <description> + This node returns a constant from a given class, such as [@GlobalScope.TYPE_INT]. See the given class' documentation for available constants. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]value[/code] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_base_type"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_class_constant"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_base_type"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_class_constant"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> + The constant's parent class. + </member> + <member name="constant" type="String" setter="set_class_constant" getter="get_class_constant"> + The constant to return. See the given class for its available constants. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptComment.xml b/modules/visual_script/doc_classes/VisualScriptComment.xml new file mode 100644 index 0000000000..ea4545f8ef --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptComment.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node used to annotate the script. + </brief_description> + <description> + 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. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_description" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_title" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_description"> + <return type="void"> + </return> + <argument index="0" name="description" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_size"> + <return type="void"> + </return> + <argument index="0" name="size" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="set_title"> + <return type="void"> + </return> + <argument index="0" name="title" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="description" type="String" setter="set_description" getter="get_description"> + The text inside the comment node. + </member> + <member name="size" type="Vector2" setter="set_size" getter="get_size"> + The comment node's size (in pixels). + </member> + <member name="title" type="String" setter="set_title" getter="get_title"> + The comment node's title. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptCondition.xml b/modules/visual_script/doc_classes/VisualScriptCondition.xml new file mode 100644 index 0000000000..2a30c604a5 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptCondition.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node which branches the flow. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptConstant.xml b/modules/visual_script/doc_classes/VisualScriptConstant.xml new file mode 100644 index 0000000000..51c6d19238 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptConstant.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Gets a contant's value. + </brief_description> + <description> + This node returns a constant's value. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]get[/code] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_constant_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="get_constant_value" qualifiers="const"> + <return type="Variant"> + </return> + <description> + </description> + </method> + <method name="set_constant_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + <method name="set_constant_value"> + <return type="void"> + </return> + <argument index="0" name="value" type="Variant"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="type" type="int" setter="set_constant_type" getter="get_constant_type" enum="Variant.Type"> + The constant's type. + </member> + <member name="value" type="Variant" setter="set_constant_value" getter="get_constant_value"> + The constant's value. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml new file mode 100644 index 0000000000..91df52e893 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node which calls a base type constructor. + </brief_description> + <description> + A Visual Script node which calls a base type constructor. It can be used for type conversion as well. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_constructor" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + </description> + </method> + <method name="get_constructor_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_constructor"> + <return type="void"> + </return> + <argument index="0" name="constructor" type="Dictionary"> + </argument> + <description> + </description> + </method> + <method name="set_constructor_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="constructor" type="Dictionary" setter="set_constructor" getter="get_constructor"> + 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] + </member> + <member name="type" type="int" setter="set_constructor_type" getter="get_constructor_type" enum="Variant.Type"> + The type to be constructed. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml new file mode 100644 index 0000000000..38c325cfb7 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A scripted Visual Script node. + </brief_description> + <description> + A custom Visual Script node which can be scripted in powerful ways. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="_get_caption" qualifiers="virtual"> + <return type="String"> + </return> + <description> + Return the node's title. + </description> + </method> + <method name="_get_category" qualifiers="virtual"> + <return type="String"> + </return> + <description> + Return the node's category. + </description> + </method> + <method name="_get_input_value_port_count" qualifiers="virtual"> + <return type="int"> + </return> + <description> + Return the count of input value ports. + </description> + </method> + <method name="_get_input_value_port_name" qualifiers="virtual"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Return the specified input port's name. + </description> + </method> + <method name="_get_input_value_port_type" qualifiers="virtual"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Return the specified input port's type. See the TYPE_* enum in [@GlobalScope]. + </description> + </method> + <method name="_get_output_sequence_port_count" qualifiers="virtual"> + <return type="int"> + </return> + <description> + Return the amount of output [b]sequence[/b] ports. + </description> + </method> + <method name="_get_output_sequence_port_text" qualifiers="virtual"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Return the specified [b]sequence[/b] output's name. + </description> + </method> + <method name="_get_output_value_port_count" qualifiers="virtual"> + <return type="int"> + </return> + <description> + Return the amount of output value ports. + </description> + </method> + <method name="_get_output_value_port_name" qualifiers="virtual"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Return the specified output's name. + </description> + </method> + <method name="_get_output_value_port_type" qualifiers="virtual"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Return the specified output's type. See the TYPE_* enum in [@GlobalScope]. + </description> + </method> + <method name="_get_text" qualifiers="virtual"> + <return type="String"> + </return> + <description> + 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). + </description> + </method> + <method name="_get_working_memory_size" qualifiers="virtual"> + <return type="int"> + </return> + <description> + Return the size of the custom node's working memory. See [method _step] for more details. + </description> + </method> + <method name="_has_input_sequence_port" qualifiers="virtual"> + <return type="bool"> + </return> + <description> + Return whether the custom node has an input [b]sequence[/b] port. + </description> + </method> + <method name="_step" qualifiers="virtual"> + <return type="Variant"> + </return> + <argument index="0" name="inputs" type="Array"> + </argument> + <argument index="1" name="outputs" type="Array"> + </argument> + <argument index="2" name="start_mode" type="int"> + </argument> + <argument index="3" name="working_mem" type="Array"> + </argument> + <description> + 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. + </description> + </method> + </methods> + <constants> + <constant name="START_MODE_BEGIN_SEQUENCE" value="0"> + The start mode used the first time when [method _step] is called. + </constant> + <constant name="START_MODE_CONTINUE_SEQUENCE" value="1"> + The start mode used when [method _step] is called after coming back from a STEP_PUSH_STACK_BIT. + </constant> + <constant name="START_MODE_RESUME_YIELD" value="2"> + The start mode used when [method _step] is called after resuming from STEP_YIELD_BIT. + </constant> + <constant name="STEP_PUSH_STACK_BIT" value="16777216" enum=""> + 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. + </constant> + <constant name="STEP_GO_BACK_BIT" value="33554432" enum=""> + Hint used by [method _step] to tell that control should return back, either hitting a previous STEP_PUSH_STACK_BIT or exiting the function. + </constant> + <constant name="STEP_NO_ADVANCE_BIT" value="67108864" enum=""> + </constant> + <constant name="STEP_EXIT_FUNCTION_BIT" value="134217728" enum=""> + Hint used by [method _step] to tell that control should stop and exit the function. + </constant> + <constant name="STEP_YIELD_BIT" value="268435456" enum=""> + 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]. + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml new file mode 100644 index 0000000000..cbed3ba22c --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node which deconstructs a base type instance into its parts. + </brief_description> + <description> + A Visual Script node which deconstructs a base type instance into its parts. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_deconstruct_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_deconstruct_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="elem_cache" type="Array" setter="_set_elem_cache" getter="_get_elem_cache"> + </member> + <member name="type" type="int" setter="set_deconstruct_type" getter="get_deconstruct_type" enum="Variant.Type"> + The type to deconstruct. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml new file mode 100644 index 0000000000..70d52b2bd7 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptEditor.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.0.alpha.custom_build"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="add_custom_node"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="category" type="String"> + </argument> + <argument index="2" name="script" type="Script"> + </argument> + <description> + Add a custom Visual Script node to the editor. It'll be placed under "Custom Nodes" with the [code]category[/code] as the parameter. + </description> + </method> + <method name="remove_custom_node"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="category" type="String"> + </argument> + <description> + Remove a custom Visual Script node from the editor. Custom nodes already placed on scripts won't be removed. + </description> + </method> + </methods> + <signals> + <signal name="custom_nodes_updated"> + <description> + Emitted when a custom Visual Script node is added or removed. + </description> + </signal> + </signals> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml new file mode 100644 index 0000000000..669276f0d0 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Emits a specified signal. + </brief_description> + <description> + Emits a specified signal when it is executed. + [b]Input Ports:[/b] + - Sequence: [code]emit[/code] + [b]Output Ports:[/b] + - Sequence + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_signal" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_signal"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="signal" type="String" setter="set_signal" getter="get_signal"> + The signal to emit. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml new file mode 100644 index 0000000000..6703ff4eda --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + A Visual Script node returning a singleton from [@GlobalScope] + </brief_description> + <description> + A Visual Script node returning a singleton from [@GlobalScope] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_singleton"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_singleton"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="constant" type="String" setter="set_singleton" getter="get_singleton"> + The singleton's name. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptExpression.xml b/modules/visual_script/doc_classes/VisualScriptExpression.xml new file mode 100644 index 0000000000..fb3b6ef19d --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptExpression.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptFunction.xml b/modules/visual_script/doc_classes/VisualScriptFunction.xml new file mode 100644 index 0000000000..d77169679b --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptFunction.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml new file mode 100644 index 0000000000..7a0a7c9f55 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_base_path" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + </description> + </method> + <method name="get_base_script" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_base_type" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_basic_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="get_call_mode" qualifiers="const"> + <return type="int" enum="VisualScriptFunctionCall.CallMode"> + </return> + <description> + </description> + </method> + <method name="get_function" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_rpc_call_mode" qualifiers="const"> + <return type="int" enum="VisualScriptFunctionCall.RPCCallMode"> + </return> + <description> + </description> + </method> + <method name="get_singleton" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_use_default_args" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_validate" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_base_path"> + <return type="void"> + </return> + <argument index="0" name="base_path" type="NodePath"> + </argument> + <description> + </description> + </method> + <method name="set_base_script"> + <return type="void"> + </return> + <argument index="0" name="base_script" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_base_type"> + <return type="void"> + </return> + <argument index="0" name="base_type" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_basic_type"> + <return type="void"> + </return> + <argument index="0" name="basic_type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + <method name="set_call_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptFunctionCall.CallMode"> + </argument> + <description> + </description> + </method> + <method name="set_function"> + <return type="void"> + </return> + <argument index="0" name="function" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_rpc_call_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptFunctionCall.RPCCallMode"> + </argument> + <description> + </description> + </method> + <method name="set_singleton"> + <return type="void"> + </return> + <argument index="0" name="singleton" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_use_default_args"> + <return type="void"> + </return> + <argument index="0" name="amount" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_validate"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="argument_cache" type="Dictionary" setter="_set_argument_cache" getter="_get_argument_cache"> + </member> + <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> + </member> + <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> + </member> + <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> + </member> + <member name="call_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptFunctionCall.CallMode"> + </member> + <member name="function" type="String" setter="set_function" getter="get_function"> + </member> + <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> + </member> + <member name="rpc_call_mode" type="int" setter="set_rpc_call_mode" getter="get_rpc_call_mode" enum="VisualScriptFunctionCall.RPCCallMode"> + </member> + <member name="singleton" type="String" setter="set_singleton" getter="get_singleton"> + </member> + <member name="use_default_args" type="int" setter="set_use_default_args" getter="get_use_default_args"> + </member> + <member name="validate" type="bool" setter="set_validate" getter="get_validate"> + </member> + </members> + <constants> + <constant name="CALL_MODE_SELF" value="0"> + </constant> + <constant name="CALL_MODE_NODE_PATH" value="1"> + </constant> + <constant name="CALL_MODE_INSTANCE" value="2"> + </constant> + <constant name="CALL_MODE_BASIC_TYPE" value="3"> + </constant> + <constant name="CALL_MODE_SINGLETON" value="4"> + </constant> + <constant name="RPC_DISABLED" value="0"> + </constant> + <constant name="RPC_RELIABLE" value="1"> + </constant> + <constant name="RPC_UNRELIABLE" value="2"> + </constant> + <constant name="RPC_RELIABLE_TO_ID" value="3"> + </constant> + <constant name="RPC_UNRELIABLE_TO_ID" value="4"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml new file mode 100644 index 0000000000..9b30f62236 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="connect_to_signal"> + <return type="void"> + </return> + <argument index="0" name="obj" type="Object"> + </argument> + <argument index="1" name="signals" type="String"> + </argument> + <argument index="2" name="args" type="Array"> + </argument> + <description> + </description> + </method> + <method name="is_valid" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="resume"> + <return type="Variant"> + </return> + <argument index="0" name="args" type="Array" default="null"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml new file mode 100644 index 0000000000..961244fe88 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_global_constant"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_global_constant"> + <return type="void"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="constant" type="int" setter="set_global_constant" getter="get_global_constant"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml new file mode 100644 index 0000000000..c5229f7678 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml new file mode 100644 index 0000000000..27646b4a5f --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml new file mode 100644 index 0000000000..7f6d13264e --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_action_mode" qualifiers="const"> + <return type="int" enum="VisualScriptInputAction.Mode"> + </return> + <description> + </description> + </method> + <method name="get_action_name" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_action_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptInputAction.Mode"> + </argument> + <description> + </description> + </method> + <method name="set_action_name"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="action" type="String" setter="set_action_name" getter="get_action_name"> + </member> + <member name="mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="VisualScriptInputAction.Mode"> + </member> + </members> + <constants> + <constant name="MODE_PRESSED" value="0"> + </constant> + <constant name="MODE_RELEASED" value="1"> + </constant> + <constant name="MODE_JUST_PRESSED" value="2"> + </constant> + <constant name="MODE_JUST_RELEASED" value="3"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptIterator.xml b/modules/visual_script/doc_classes/VisualScriptIterator.xml new file mode 100644 index 0000000000..fc905d6c39 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptIterator.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Steps through items in a given input. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml new file mode 100644 index 0000000000..ff77dfac0d --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Gets a local variable's value. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_var_name" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_var_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_var_name"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_var_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type"> + The local variable's type. + </member> + <member name="var_name" type="String" setter="set_var_name" getter="get_var_name"> + The local variable's name. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml new file mode 100644 index 0000000000..07b01d4576 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Changes a local variable's value. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_var_name" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_var_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_var_name"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_var_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type"> + The local variable's type. + </member> + <member name="var_name" type="String" setter="set_var_name" getter="get_var_name"> + The local variable's name. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml new file mode 100644 index 0000000000..817bcb5ce2 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Commonly used mathematical constants. + </brief_description> + <description> + Provides common math constants, such as Pi or Euler's constant, on an output Data port. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (variant): [code]get[/code] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_math_constant"> + <return type="int" enum="VisualScriptMathConstant.MathConstant"> + </return> + <description> + </description> + </method> + <method name="set_math_constant"> + <return type="void"> + </return> + <argument index="0" name="which" type="int" enum="VisualScriptMathConstant.MathConstant"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="constant" type="int" setter="set_math_constant" getter="get_math_constant" enum="VisualScriptMathConstant.MathConstant"> + The math constant. + </member> + </members> + <constants> + <constant name="MATH_CONSTANT_ONE" value="0"> + Unity: [code]1[/code] + </constant> + <constant name="MATH_CONSTANT_PI" value="1"> + Pi: [code]3.141593[/code] + </constant> + <constant name="MATH_CONSTANT_HALF_PI" value="2"> + Pi divided by two: [code]1.570796[/code] + </constant> + <constant name="MATH_CONSTANT_TAU" value="3"> + Tau: [code]6.283185[/code] + </constant> + <constant name="MATH_CONSTANT_E" value="4"> + Natural log: [code]2.718282[/code] + </constant> + <constant name="MATH_CONSTANT_SQRT2" value="5"> + Square root of two: [code]1.414214[/code] + </constant> + <constant name="MATH_CONSTANT_INF" value="6"> + Infinity: [code]inf[/code] + </constant> + <constant name="MATH_CONSTANT_NAN" value="7"> + Not a number: [code]nan[/code] + </constant> + <constant name="MATH_CONSTANT_MAX" value="8"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml new file mode 100644 index 0000000000..f6f2867172 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptNode.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0-alpha"> + <brief_description> + A node which is part of a [VisualScript]. + </brief_description> + <description> + A node which is part of a [VisualScript]. Not to be confused with [Node], which is a part of a [SceneTree]. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_default_input_value" qualifiers="const"> + <return type="Variant"> + </return> + <argument index="0" name="port_idx" type="int"> + </argument> + <description> + Returns the default value of a given port. The default value is used when nothing is connected to the port. + </description> + </method> + <method name="get_visual_script" qualifiers="const"> + <return type="VisualScript"> + </return> + <description> + Returns the [VisualScript] instance the node is bound to. + </description> + </method> + <method name="ports_changed_notify"> + <return type="void"> + </return> + <description> + Notify that the node's ports have changed. Usually used in conjunction with [VisualScriptCustomNode] . + </description> + </method> + <method name="set_default_input_value"> + <return type="void"> + </return> + <argument index="0" name="port_idx" type="int"> + </argument> + <argument index="1" name="value" type="Variant"> + </argument> + <description> + Change the default value of a given port. + </description> + </method> + </methods> + <members> + <member name="_default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values"> + </member> + </members> + <signals> + <signal name="ports_changed"> + <description> + Emitted when the available input/output ports are changed. + </description> + </signal> + </signals> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptOperator.xml b/modules/visual_script/doc_classes/VisualScriptOperator.xml new file mode 100644 index 0000000000..bf4032c09c --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptOperator.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + [b]Input Ports:[/b] + - Data (variant): [code]A[/code] + - Data (variant): [code]B[/code] + [b]Output Ports:[/b] + - Data (variant): [code]result[/code] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_operator" qualifiers="const"> + <return type="int" enum="Variant.Operator"> + </return> + <description> + </description> + </method> + <method name="get_typed" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_operator"> + <return type="void"> + </return> + <argument index="0" name="op" type="int" enum="Variant.Operator"> + </argument> + <description> + </description> + </method> + <method name="set_typed"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="operator" type="int" setter="set_operator" getter="get_operator" enum="Variant.Operator"> + </member> + <member name="type" type="int" setter="set_typed" getter="get_typed" enum="Variant.Type"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptPreload.xml b/modules/visual_script/doc_classes/VisualScriptPreload.xml new file mode 100644 index 0000000000..4a71e23809 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptPreload.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Creates a new [Resource] or loads one from the filesystem. + </brief_description> + <description> + Creates a new [Resource] or loads one from the filesystem. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (object): [code]res[/code] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_preload" qualifiers="const"> + <return type="Resource"> + </return> + <description> + </description> + </method> + <method name="set_preload"> + <return type="void"> + </return> + <argument index="0" name="resource" type="Resource"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="resource" type="Resource" setter="set_preload" getter="get_preload"> + The [Resource] to load. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml new file mode 100644 index 0000000000..eb5c52f4be --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_base_path" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + </description> + </method> + <method name="get_base_script" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_base_type" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_basic_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="get_call_mode" qualifiers="const"> + <return type="int" enum="VisualScriptPropertyGet.CallMode"> + </return> + <description> + </description> + </method> + <method name="get_index" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_property" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_base_path"> + <return type="void"> + </return> + <argument index="0" name="base_path" type="NodePath"> + </argument> + <description> + </description> + </method> + <method name="set_base_script"> + <return type="void"> + </return> + <argument index="0" name="base_script" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_base_type"> + <return type="void"> + </return> + <argument index="0" name="base_type" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_basic_type"> + <return type="void"> + </return> + <argument index="0" name="basic_type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + <method name="set_call_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptPropertyGet.CallMode"> + </argument> + <description> + </description> + </method> + <method name="set_index"> + <return type="void"> + </return> + <argument index="0" name="index" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_property"> + <return type="void"> + </return> + <argument index="0" name="property" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> + </member> + <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> + </member> + <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> + </member> + <member name="index" type="String" setter="set_index" getter="get_index"> + </member> + <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> + </member> + <member name="property" type="String" setter="set_property" getter="get_property"> + </member> + <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertyGet.CallMode"> + </member> + <member name="type_cache" type="int" setter="_set_type_cache" getter="_get_type_cache" enum="Variant.Type"> + </member> + </members> + <constants> + <constant name="CALL_MODE_SELF" value="0"> + </constant> + <constant name="CALL_MODE_NODE_PATH" value="1"> + </constant> + <constant name="CALL_MODE_INSTANCE" value="2"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml new file mode 100644 index 0000000000..794caa2518 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_assign_op" qualifiers="const"> + <return type="int" enum="VisualScriptPropertySet.AssignOp"> + </return> + <description> + </description> + </method> + <method name="get_base_path" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + </description> + </method> + <method name="get_base_script" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_base_type" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_basic_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="get_call_mode" qualifiers="const"> + <return type="int" enum="VisualScriptPropertySet.CallMode"> + </return> + <description> + </description> + </method> + <method name="get_index" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_property" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_assign_op"> + <return type="void"> + </return> + <argument index="0" name="assign_op" type="int" enum="VisualScriptPropertySet.AssignOp"> + </argument> + <description> + </description> + </method> + <method name="set_base_path"> + <return type="void"> + </return> + <argument index="0" name="base_path" type="NodePath"> + </argument> + <description> + </description> + </method> + <method name="set_base_script"> + <return type="void"> + </return> + <argument index="0" name="base_script" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_base_type"> + <return type="void"> + </return> + <argument index="0" name="base_type" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_basic_type"> + <return type="void"> + </return> + <argument index="0" name="basic_type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + <method name="set_call_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptPropertySet.CallMode"> + </argument> + <description> + </description> + </method> + <method name="set_index"> + <return type="void"> + </return> + <argument index="0" name="index" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_property"> + <return type="void"> + </return> + <argument index="0" name="property" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="assign_op" type="int" setter="set_assign_op" getter="get_assign_op" enum="VisualScriptPropertySet.AssignOp"> + </member> + <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> + </member> + <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> + </member> + <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type"> + </member> + <member name="index" type="String" setter="set_index" getter="get_index"> + </member> + <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> + </member> + <member name="property" type="String" setter="set_property" getter="get_property"> + </member> + <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertySet.CallMode"> + </member> + <member name="type_cache" type="Dictionary" setter="_set_type_cache" getter="_get_type_cache"> + </member> + </members> + <constants> + <constant name="CALL_MODE_SELF" value="0"> + </constant> + <constant name="CALL_MODE_NODE_PATH" value="1"> + </constant> + <constant name="CALL_MODE_INSTANCE" value="2"> + </constant> + <constant name="CALL_MODE_BASIC_TYPE" value="3"> + </constant> + <constant name="ASSIGN_OP_NONE" value="0"> + </constant> + <constant name="ASSIGN_OP_ADD" value="1"> + </constant> + <constant name="ASSIGN_OP_SUB" value="2"> + </constant> + <constant name="ASSIGN_OP_MUL" value="3"> + </constant> + <constant name="ASSIGN_OP_DIV" value="4"> + </constant> + <constant name="ASSIGN_OP_MOD" value="5"> + </constant> + <constant name="ASSIGN_OP_SHIFT_LEFT" value="6"> + </constant> + <constant name="ASSIGN_OP_SHIFT_RIGHT" value="7"> + </constant> + <constant name="ASSIGN_OP_BIT_AND" value="8"> + </constant> + <constant name="ASSIGN_OP_BIT_OR" value="9"> + </constant> + <constant name="ASSIGN_OP_BIT_XOR" value="10"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml new file mode 100644 index 0000000000..274a852c3e --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_resource_path"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_resource_path"> + <return type="void"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="path" type="String" setter="set_resource_path" getter="get_resource_path"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptReturn.xml b/modules/visual_script/doc_classes/VisualScriptReturn.xml new file mode 100644 index 0000000000..4ac586a02c --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptReturn.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Exits a function and returns an optional value. + </brief_description> + <description> + 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 + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_return_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="is_return_value_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_enable_return_value"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_return_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="return_enabled" type="bool" setter="set_enable_return_value" getter="is_return_value_enabled"> + If [code]true[/code] the [code]return[/code] input port is available. + </member> + <member name="return_type" type="int" setter="set_return_type" getter="get_return_type" enum="Variant.Type"> + The return value's data type. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml new file mode 100644 index 0000000000..e8fdb69c6a --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Node reference. + </brief_description> + <description> + A direct reference to a node. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data: [code]node[/code] (obj) + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_node_path"> + <return type="NodePath"> + </return> + <description> + </description> + </method> + <method name="set_node_path"> + <return type="void"> + </return> + <argument index="0" name="path" type="NodePath"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="node_path" type="NodePath" setter="set_node_path" getter="get_node_path"> + The node's path in the scene tree. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml new file mode 100644 index 0000000000..e74c330623 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSelect.xml b/modules/visual_script/doc_classes/VisualScriptSelect.xml new file mode 100644 index 0000000000..6a62e364f3 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSelect.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Chooses between two input values. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_typed" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_typed"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="type" type="int" setter="set_typed" getter="get_typed" enum="Variant.Type"> + The input variables' type. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSelf.xml b/modules/visual_script/doc_classes/VisualScriptSelf.xml new file mode 100644 index 0000000000..f39a02bf84 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSelf.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Outputs a reference to the current instance. + </brief_description> + <description> + Provides a reference to the node running the visual script. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data (object): [code]instance[/code] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSequence.xml b/modules/visual_script/doc_classes/VisualScriptSequence.xml new file mode 100644 index 0000000000..51238070d5 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSequence.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Executes a series of Sequence ports. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_steps" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_steps"> + <return type="void"> + </return> + <argument index="0" name="steps" type="int"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="steps" type="int" setter="set_steps" getter="get_steps"> + The number of steps in the sequence. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml new file mode 100644 index 0000000000..381095f49b --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSubCall.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="_subcall" qualifiers="virtual"> + <return type="Variant"> + </return> + <argument index="0" name="arguments" type="Variant"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptSwitch.xml b/modules/visual_script/doc_classes/VisualScriptSwitch.xml new file mode 100644 index 0000000000..3c8a79f686 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptSwitch.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Branches program flow based on a given input's value. + </brief_description> + <description> + Branches the flow based on an input's value. Use "Case Count" 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml new file mode 100644 index 0000000000..417c0a5159 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_base_script" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_base_type" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_base_script"> + <return type="void"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_base_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> + </member> + <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml new file mode 100644 index 0000000000..1cad4480a6 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Gets a variable's value. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_variable" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_variable"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="var_name" type="String" setter="set_variable" getter="get_variable"> + The variable's name. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml new file mode 100644 index 0000000000..fa3befa21d --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Changes a variable's value. + </brief_description> + <description> + Changes a variable's value to the given input. + [b]Input Ports:[/b] + - Sequence + - Data (variant): [code]set[/code] + [b]Output Ports:[/b] + - Sequence + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_variable" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_variable"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="var_name" type="String" setter="set_variable" getter="get_variable"> + The variable's name. + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptWhile.xml b/modules/visual_script/doc_classes/VisualScriptWhile.xml new file mode 100644 index 0000000000..f948660997 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptWhile.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + Conditional loop. + </brief_description> + <description> + 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] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml new file mode 100644 index 0000000000..5474ee8b78 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptYield.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_wait_time"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="get_yield_mode"> + <return type="int" enum="VisualScriptYield.YieldMode"> + </return> + <description> + </description> + </method> + <method name="set_wait_time"> + <return type="void"> + </return> + <argument index="0" name="sec" type="float"> + </argument> + <description> + </description> + </method> + <method name="set_yield_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptYield.YieldMode"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="mode" type="int" setter="set_yield_mode" getter="get_yield_mode" enum="VisualScriptYield.YieldMode"> + </member> + <member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time"> + </member> + </members> + <constants> + <constant name="YIELD_FRAME" value="1"> + </constant> + <constant name="YIELD_PHYSICS_FRAME" value="2"> + </constant> + <constant name="YIELD_WAIT" value="3"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml new file mode 100644 index 0000000000..a3b6982075 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_base_path" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + </description> + </method> + <method name="get_base_type" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_call_mode" qualifiers="const"> + <return type="int" enum="VisualScriptYieldSignal.CallMode"> + </return> + <description> + </description> + </method> + <method name="get_signal" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_base_path"> + <return type="void"> + </return> + <argument index="0" name="base_path" type="NodePath"> + </argument> + <description> + </description> + </method> + <method name="set_base_type"> + <return type="void"> + </return> + <argument index="0" name="base_type" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_call_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptYieldSignal.CallMode"> + </argument> + <description> + </description> + </method> + <method name="set_signal"> + <return type="void"> + </return> + <argument index="0" name="signal" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> + </member> + <member name="call_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptYieldSignal.CallMode"> + </member> + <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path"> + </member> + <member name="signal" type="String" setter="set_signal" getter="get_signal"> + </member> + </members> + <constants> + <constant name="CALL_MODE_SELF" value="0"> + </constant> + <constant name="CALL_MODE_NODE_PATH" value="1"> + </constant> + <constant name="CALL_MODE_INSTANCE" value="2"> + </constant> + </constants> +</class> diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index c50ba17c35..b6ce10381d 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "register_types.h" +#include "core/engine.h" #include "io/resource_loader.h" #include "visual_script.h" #include "visual_script_builtin_funcs.h" @@ -40,6 +41,9 @@ #include "visual_script_yield_nodes.h" VisualScriptLanguage *visual_script_language = NULL; +#ifdef TOOLS_ENABLED +static _VisualScriptEditor *vs_editor_singleton = NULL; +#endif void register_visual_script_types() { @@ -107,6 +111,10 @@ void register_visual_script_types() { register_visual_script_expression_node(); #ifdef TOOLS_ENABLED + ClassDB::register_class<_VisualScriptEditor>(); + vs_editor_singleton = memnew(_VisualScriptEditor); + Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton())); + VisualScriptEditor::register_editor(); #endif } @@ -119,6 +127,9 @@ void unregister_visual_script_types() { #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/visual_script.cpp b/modules/visual_script/visual_script.cpp index 48145495e4..0834bc81d9 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -974,11 +974,6 @@ bool VisualScript::is_tool() const { return false; } -String VisualScript::get_node_type() const { - - return String(); -} - ScriptLanguage *VisualScript::get_language() const { return VisualScriptLanguage::singleton; @@ -2412,6 +2407,10 @@ bool VisualScriptLanguage::has_named_classes() const { return false; } +bool VisualScriptLanguage::supports_builtin_mode() const { + + return true; +} int VisualScriptLanguage::find_function(const String &p_function, const String &p_code) const { return -1; @@ -2645,6 +2644,11 @@ void VisualScriptLanguage::add_register_func(const String &p_name, VisualScriptN register_funcs[p_name] = p_func; } +void VisualScriptLanguage::remove_register_func(const String &p_name) { + ERR_FAIL_COND(!register_funcs.has(p_name)); + register_funcs.erase(p_name); +} + Ref<VisualScriptNode> VisualScriptLanguage::create_node_from_name(const String &p_name) { ERR_FAIL_COND_V(!register_funcs.has(p_name), Ref<VisualScriptNode>()); diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 4ae50ee829..3e31876941 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -339,8 +339,6 @@ public: virtual bool is_tool() const; - virtual String get_node_type() const; - virtual ScriptLanguage *get_language() const; virtual bool has_script_signal(const StringName &p_signal) const; @@ -569,6 +567,7 @@ public: virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const; virtual Script *create_script() const; virtual bool has_named_classes() const; + virtual bool supports_builtin_mode() const; virtual int find_function(const String &p_function, const String &p_code) const; virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const; @@ -601,6 +600,7 @@ public: virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max); void add_register_func(const String &p_name, VisualScriptNodeRegisterFunc p_func); + void remove_register_func(const String &p_name); Ref<VisualScriptNode> create_node_from_name(const String &p_name); void get_registered_node_names(List<String> *r_names); diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 4b294325dc..8f7fe58bee 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -78,6 +78,8 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX "rad2deg", "linear2db", "db2linear", + "wrapi", + "wrapf", "max", "min", "clamp", @@ -198,6 +200,8 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) { case MATH_LERP: case MATH_INVERSE_LERP: case MATH_DECTIME: + case MATH_WRAP: + case MATH_WRAPF: case LOGIC_CLAMP: return 3; case MATH_RANGE_LERP: @@ -364,6 +368,22 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const case MATH_DB2LINEAR: { return PropertyInfo(Variant::REAL, "db"); } break; + case MATH_WRAP: { + if (p_idx == 0) + return PropertyInfo(Variant::INT, "value"); + else if (p_idx == 1) + return PropertyInfo(Variant::INT, "min"); + else + return PropertyInfo(Variant::INT, "max"); + } break; + case MATH_WRAPF: { + if (p_idx == 0) + return PropertyInfo(Variant::REAL, "value"); + else if (p_idx == 1) + return PropertyInfo(Variant::REAL, "min"); + else + return PropertyInfo(Variant::REAL, "max"); + } break; case LOGIC_MAX: { if (p_idx == 0) return PropertyInfo(Variant::REAL, "a"); @@ -549,9 +569,13 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons case MATH_DEG2RAD: case MATH_RAD2DEG: case MATH_LINEAR2DB: + case MATH_WRAPF: case MATH_DB2LINEAR: { t = Variant::REAL; } break; + case MATH_WRAP: { + t = Variant::INT; + } break; case LOGIC_MAX: case LOGIC_MIN: case LOGIC_CLAMP: { @@ -898,6 +922,18 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in VALIDATE_ARG_NUM(0); *r_return = Math::db2linear((double)*p_inputs[0]); } break; + case VisualScriptBuiltinFunc::MATH_WRAP: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return = Math::wrapi((int64_t)*p_inputs[0], (int64_t)*p_inputs[1], (int64_t)*p_inputs[2]); + } break; + case VisualScriptBuiltinFunc::MATH_WRAPF: { + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + *r_return = Math::wrapf((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]); + } break; case VisualScriptBuiltinFunc::LOGIC_MAX: { if (p_inputs[0]->get_type() == Variant::INT && p_inputs[1]->get_type() == Variant::INT) { @@ -1073,7 +1109,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in String str = *p_inputs[0]; //str+="\n"; - OS::get_singleton()->printerr("%s\n", str.utf8().get_data()); + print_error(str); } break; case VisualScriptBuiltinFunc::TEXT_PRINTRAW: { @@ -1258,6 +1294,8 @@ void VisualScriptBuiltinFunc::_bind_methods() { BIND_ENUM_CONSTANT(MATH_RAD2DEG); BIND_ENUM_CONSTANT(MATH_LINEAR2DB); BIND_ENUM_CONSTANT(MATH_DB2LINEAR); + BIND_ENUM_CONSTANT(MATH_WRAP); + BIND_ENUM_CONSTANT(MATH_WRAPF); BIND_ENUM_CONSTANT(LOGIC_MAX); BIND_ENUM_CONSTANT(LOGIC_MIN); BIND_ENUM_CONSTANT(LOGIC_CLAMP); @@ -1343,6 +1381,8 @@ void register_visual_script_builtin_func_node() { VisualScriptLanguage::singleton->add_register_func("functions/built_in/rad2deg", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RAD2DEG>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/linear2db", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LINEAR2DB>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/db2linear", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DB2LINEAR>); + VisualScriptLanguage::singleton->add_register_func("functions/built_in/wrapi", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_WRAP>); + VisualScriptLanguage::singleton->add_register_func("functions/built_in/wrapf", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_WRAPF>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/max", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_MAX>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/min", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_MIN>); diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index 5758d23e8f..34a2825938 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -77,6 +77,8 @@ public: MATH_RAD2DEG, MATH_LINEAR2DB, MATH_DB2LINEAR, + MATH_WRAP, + MATH_WRAPF, LOGIC_MAX, LOGIC_MIN, LOGIC_CLAMP, diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 03015df844..83b8d8da2d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "visual_script_editor.h" +#include "core/script_language.h" #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" #include "os/input.h" @@ -348,7 +349,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break; case Variant::PLANE: color = Color::html("#f77070"); break; case Variant::QUAT: color = Color::html("#ec69a3"); break; - case Variant::RECT3: color = Color::html("#ee7991"); break; + case Variant::AABB: color = Color::html("#ee7991"); break; case Variant::BASIS: color = Color::html("#e3ec69"); break; case Variant::TRANSFORM: color = Color::html("#f6a86e"); break; @@ -385,7 +386,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break; case Variant::PLANE: color = Color::html("#f77070"); break; case Variant::QUAT: color = Color::html("#ec69a3"); break; - case Variant::RECT3: color = Color::html("#ee7991"); break; + case Variant::AABB: color = Color::html("#ee7991"); break; case Variant::BASIS: color = Color::html("#b2bb19"); break; case Variant::TRANSFORM: color = Color::html("#f49047"); break; @@ -2764,6 +2765,23 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i default_value_edit->set_position(Object::cast_to<Control>(p_button)->get_global_position() + Vector2(0, Object::cast_to<Control>(p_button)->get_size().y)); default_value_edit->set_size(Size2(1, 1)); + + if (pinfo.type == Variant::NODE_PATH) { + + Node *edited_scene = get_tree()->get_edited_scene_root(); + Node *script_node = _find_script_node(edited_scene, edited_scene, script); + + if (script_node) { + //pick a node relative to the script, IF the script exists + pinfo.hint = PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE; + pinfo.hint_string = script_node->get_path(); + } else { + //pick a path relative to edited scene + pinfo.hint = PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE; + pinfo.hint_string = get_tree()->get_edited_scene_root()->get_path(); + } + } + if (default_value_edit->edit(NULL, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) { if (pinfo.hint == PROPERTY_HINT_MULTILINE_TEXT) default_value_edit->popup_centered_ratio(); @@ -3241,6 +3259,8 @@ void VisualScriptEditor::_bind_methods() { ClassDB::bind_method("_member_rmb_selected", &VisualScriptEditor::_member_rmb_selected); ClassDB::bind_method("_member_option", &VisualScriptEditor::_member_option); + + ClassDB::bind_method("_update_available_nodes", &VisualScriptEditor::_update_available_nodes); } VisualScriptEditor::VisualScriptEditor() { @@ -3425,6 +3445,8 @@ VisualScriptEditor::VisualScriptEditor() { members->connect("item_rmb_selected", this, "_member_rmb_selected"); members->set_allow_rmb_select(true); member_popup->connect("id_pressed", this, "_member_option"); + + _VisualScriptEditor::get_singleton()->connect("custom_nodes_updated", this, "_update_available_nodes"); } VisualScriptEditor::~VisualScriptEditor() { @@ -3468,4 +3490,42 @@ void VisualScriptEditor::register_editor() { EditorNode::add_plugin_init_callback(register_editor_callback); } +Ref<VisualScriptNode> _VisualScriptEditor::create_node_custom(const String &p_name) { + + Ref<VisualScriptCustomNode> node; + node.instance(); + node->set_script(singleton->custom_nodes[p_name]); + return node; +} + +_VisualScriptEditor *_VisualScriptEditor::singleton = NULL; +Map<String, RefPtr> _VisualScriptEditor::custom_nodes; + +_VisualScriptEditor::_VisualScriptEditor() { + singleton = this; +} + +_VisualScriptEditor::~_VisualScriptEditor() { + custom_nodes.clear(); +} + +void _VisualScriptEditor::add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script) { + String node_name = "custom/" + p_category + "/" + p_name; + custom_nodes.insert(node_name, p_script.get_ref_ptr()); + VisualScriptLanguage::singleton->add_register_func(node_name, &_VisualScriptEditor::create_node_custom); + emit_signal("custom_nodes_updated"); +} + +void _VisualScriptEditor::remove_custom_node(const String &p_name, const String &p_category) { + String node_name = "custom/" + p_category + "/" + p_name; + custom_nodes.erase(node_name); + VisualScriptLanguage::singleton->remove_register_func(node_name); + emit_signal("custom_nodes_updated"); +} + +void _VisualScriptEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("add_custom_node", "name", "category", "script"), &_VisualScriptEditor::add_custom_node); + ClassDB::bind_method(D_METHOD("remove_custom_node", "name", "category"), &_VisualScriptEditor::remove_custom_node); + ADD_SIGNAL(MethodInfo("custom_nodes_updated")); +} #endif diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index db54d10300..3d037e82ea 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -278,6 +278,29 @@ public: VisualScriptEditor(); ~VisualScriptEditor(); }; + +// Singleton +class _VisualScriptEditor : public Object { + GDCLASS(_VisualScriptEditor, Object); + + friend class VisualScriptLanguage; + +protected: + static void _bind_methods(); + static _VisualScriptEditor *singleton; + + static Map<String, RefPtr> custom_nodes; + static Ref<VisualScriptNode> create_node_custom(const String &p_name); + +public: + static _VisualScriptEditor *get_singleton() { return singleton; } + + void add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script); + void remove_custom_node(const String &p_name, const String &p_category); + + _VisualScriptEditor(); + ~_VisualScriptEditor(); +}; #endif #endif // VISUALSCRIPT_EDITOR_H diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 897e910f20..07dca4b904 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -564,6 +564,9 @@ Error VisualScriptExpression::_get_token(Token &r_token) { } else if (id == "PI") { r_token.type = TK_CONSTANT; r_token.value = Math_PI; + } else if (id == "TAU") { + r_token.type = TK_CONSTANT; + r_token.value = Math_TAU; } else if (id == "INF") { r_token.type = TK_CONSTANT; r_token.value = Math_INF; diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 8d73de9889..cbe4438cdf 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -29,9 +29,9 @@ /*************************************************************************/ #include "visual_script_func_nodes.h" +#include "engine.h" #include "io/resource_loader.h" #include "os/os.h" -#include "project_settings.h" #include "scene/main/node.h" #include "scene/main/scene_tree.h" #include "visual_script_nodes.h" @@ -344,7 +344,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName &p_type) { return; singleton = p_type; - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { base_type = obj->get_class(); } @@ -380,7 +380,7 @@ void VisualScriptFunctionCall::_update_method_cache() { } else if (call_mode == CALL_MODE_SINGLETON) { - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { type = obj->get_class(); script = obj->get_script(); @@ -565,11 +565,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (call_mode != CALL_MODE_SINGLETON) { property.usage = 0; } else { - List<ProjectSettings::Singleton> names; - ProjectSettings::get_singleton()->get_singletons(&names); + List<Engine::Singleton> names; + Engine::get_singleton()->get_singletons(&names); property.hint = PROPERTY_HINT_ENUM; String sl; - for (List<ProjectSettings::Singleton>::Element *E = names.front(); E; E = E->next()) { + for (List<Engine::Singleton>::Element *E = names.front(); E; E = E->next()) { if (sl != String()) sl += ","; sl += E->get().name; @@ -603,7 +603,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_SINGLETON) { - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; property.hint_string = itos(obj->get_instance_id()); @@ -858,6 +858,8 @@ public: if (call_mode == VisualScriptFunctionCall::CALL_MODE_INSTANCE) { if (returns >= 2) { *p_outputs[1] = v.call(function, p_inputs + 1, input_args, r_error); + } else if (returns == 1) { + v.call(function, p_inputs + 1, input_args, r_error); } else { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Invalid returns count for call_mode == CALL_MODE_INSTANCE"; @@ -877,7 +879,7 @@ public: } break; case VisualScriptFunctionCall::CALL_MODE_SINGLETON: { - Object *object = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *object = Engine::get_singleton()->get_singleton_object(singleton); if (!object) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Invalid singleton name: '" + String(singleton) + "'"; diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index d3cd839cf3..05ff629d1b 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "visual_script_nodes.h" +#include "engine.h" #include "global_constants.h" #include "os/input.h" #include "os/os.h" @@ -1776,8 +1777,8 @@ VisualScriptBasicTypeConstant::VisualScriptBasicTypeConstant() { const char *VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX] = { "One", "PI", - "PIx2", "PI/2", + "TAU", "E", "Sqrt2", "INF", @@ -1787,8 +1788,8 @@ const char *VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX] = { double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX] = { 1.0, Math_PI, - Math_PI * 2, Math_PI * 0.5, + Math_TAU, 2.71828182845904523536, Math::sqrt(2.0), Math_INF, @@ -1886,8 +1887,8 @@ void VisualScriptMathConstant::_bind_methods() { BIND_ENUM_CONSTANT(MATH_CONSTANT_ONE); BIND_ENUM_CONSTANT(MATH_CONSTANT_PI); - BIND_ENUM_CONSTANT(MATH_CONSTANT_2PI); BIND_ENUM_CONSTANT(MATH_CONSTANT_HALF_PI); + BIND_ENUM_CONSTANT(MATH_CONSTANT_TAU); BIND_ENUM_CONSTANT(MATH_CONSTANT_E); BIND_ENUM_CONSTANT(MATH_CONSTANT_SQRT2); BIND_ENUM_CONSTANT(MATH_CONSTANT_INF); @@ -1976,13 +1977,13 @@ public: VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) { VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton); - instance->singleton = ProjectSettings::get_singleton()->get_singleton_object(singleton); + instance->singleton = Engine::get_singleton()->get_singleton_object(singleton); return instance; } VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess *p_inputs, int p_output) const { - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); TypeGuess tg; tg.type = Variant::OBJECT; if (obj) { @@ -2000,11 +2001,11 @@ void VisualScriptEngineSingleton::_bind_methods() { String cc; - List<ProjectSettings::Singleton> singletons; + List<Engine::Singleton> singletons; - ProjectSettings::get_singleton()->get_singletons(&singletons); + Engine::get_singleton()->get_singletons(&singletons); - for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) { if (E->get().name == "VS" || E->get().name == "PS" || E->get().name == "PS2D" || E->get().name == "AS" || E->get().name == "TS" || E->get().name == "SS" || E->get().name == "SS2D") continue; //skip these, too simple named diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index 421409b265..6648f57e7b 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -474,8 +474,8 @@ public: enum MathConstant { MATH_CONSTANT_ONE, MATH_CONSTANT_PI, - MATH_CONSTANT_2PI, MATH_CONSTANT_HALF_PI, + MATH_CONSTANT_TAU, MATH_CONSTANT_E, MATH_CONSTANT_SQRT2, MATH_CONSTANT_INF, |