summaryrefslogtreecommitdiff
path: root/modules/visual_script
diff options
context:
space:
mode:
Diffstat (limited to 'modules/visual_script')
-rw-r--r--modules/visual_script/SCsub5
-rw-r--r--modules/visual_script/config.py55
-rw-r--r--modules/visual_script/doc_classes/VisualScript.xml512
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml25
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml211
-rw-r--r--modules/visual_script/doc_classes/VisualScriptClassConstant.xml29
-rw-r--r--modules/visual_script/doc_classes/VisualScriptComment.xml29
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCondition.xml24
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstant.xml29
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstructor.xml45
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCustomNode.xml165
-rw-r--r--modules/visual_script/doc_classes/VisualScriptDeconstruct.xml22
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEditor.xml46
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEmitSignal.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml22
-rw-r--r--modules/visual_script/doc_classes/VisualScriptExpression.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunction.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionCall.xml57
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionState.xml41
-rw-r--r--modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml19
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexGet.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexSet.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptInputAction.xml29
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIterator.xml24
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVar.xml29
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml31
-rw-r--r--modules/visual_script/doc_classes/VisualScriptMathConstant.xml52
-rw-r--r--modules/visual_script/doc_classes/VisualScriptNode.xml58
-rw-r--r--modules/visual_script/doc_classes/VisualScriptOperator.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPreload.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertyGet.xml37
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertySet.xml63
-rw-r--r--modules/visual_script/doc_classes/VisualScriptResourcePath.xml19
-rw-r--r--modules/visual_script/doc_classes/VisualScriptReturn.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneNode.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneTree.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelect.xml28
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelf.xml21
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSequence.xml28
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSubCall.xml23
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSwitch.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptTypeCast.xml21
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableGet.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableSet.xml27
-rw-r--r--modules/visual_script/doc_classes/VisualScriptWhile.xml23
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYield.xml27
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYieldSignal.xml31
-rw-r--r--modules/visual_script/register_types.cpp18
-rw-r--r--modules/visual_script/register_types.h5
-rw-r--r--modules/visual_script/visual_script.cpp31
-rw-r--r--modules/visual_script/visual_script.h12
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp61
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h7
-rw-r--r--modules/visual_script/visual_script_editor.cpp234
-rw-r--r--modules/visual_script/visual_script_editor.h29
-rw-r--r--modules/visual_script/visual_script_expression.cpp14
-rw-r--r--modules/visual_script/visual_script_expression.h5
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp920
-rw-r--r--modules/visual_script/visual_script_flow_control.h39
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp37
-rw-r--r--modules/visual_script/visual_script_func_nodes.h5
-rw-r--r--modules/visual_script/visual_script_nodes.cpp46
-rw-r--r--modules/visual_script/visual_script_nodes.h7
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp5
-rw-r--r--modules/visual_script/visual_script_yield_nodes.h5
65 files changed, 2529 insertions, 1119 deletions
diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub
index 0882406761..96ee911ba0 100644
--- a/modules/visual_script/SCsub
+++ b/modules/visual_script/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_vs = env_modules.Clone()
+
+env_vs.add_source_files(env.modules_sources, "*.cpp")
Export('env')
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..dab186fb57
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScript.xml
@@ -0,0 +1,512 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScript" inherits="Script" category="Core" version="3.1">
+ <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>
+ http://docs.godotengine.org/en/3.0/getting_started/scripting/visual_script/index.html
+ </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>
+ <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..793291eca2
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..0929b227d0
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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" enum="BuiltinFunc">
+ Return the sine of the input.
+ </constant>
+ <constant name="MATH_COS" value="1" enum="BuiltinFunc">
+ Return the cosine of the input.
+ </constant>
+ <constant name="MATH_TAN" value="2" enum="BuiltinFunc">
+ Return the tangent of the input.
+ </constant>
+ <constant name="MATH_SINH" value="3" enum="BuiltinFunc">
+ Return the hyperbolic sine of the input.
+ </constant>
+ <constant name="MATH_COSH" value="4" enum="BuiltinFunc">
+ Return the hyperbolic cosine of the input.
+ </constant>
+ <constant name="MATH_TANH" value="5" enum="BuiltinFunc">
+ Return the hyperbolic tangent of the input.
+ </constant>
+ <constant name="MATH_ASIN" value="6" enum="BuiltinFunc">
+ Return the arc sine of the input.
+ </constant>
+ <constant name="MATH_ACOS" value="7" enum="BuiltinFunc">
+ Return the arc cosine of the input.
+ </constant>
+ <constant name="MATH_ATAN" value="8" enum="BuiltinFunc">
+ Return the arc tangent of the input.
+ </constant>
+ <constant name="MATH_ATAN2" value="9" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ Return the square root of the input.
+ </constant>
+ <constant name="MATH_FMOD" value="11" enum="BuiltinFunc">
+ Return the remainder of one input divided by the other, using floating-point numbers.
+ </constant>
+ <constant name="MATH_FPOSMOD" value="12" enum="BuiltinFunc">
+ Return the positive remainder of one input divided by the other, using floating-point numbers.
+ </constant>
+ <constant name="MATH_FLOOR" value="13" enum="BuiltinFunc">
+ Return the input rounded down.
+ </constant>
+ <constant name="MATH_CEIL" value="14" enum="BuiltinFunc">
+ Return the input rounded up.
+ </constant>
+ <constant name="MATH_ROUND" value="15" enum="BuiltinFunc">
+ Return the input rounded to the nearest integer.
+ </constant>
+ <constant name="MATH_ABS" value="16" enum="BuiltinFunc">
+ Return the absolute value of the input.
+ </constant>
+ <constant name="MATH_SIGN" value="17" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ Return the input raised to a given power.
+ </constant>
+ <constant name="MATH_LOG" value="19" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ Return the number of digit places after the decimal that the first non-zero digit occurs.
+ </constant>
+ <constant name="MATH_STEPIFY" value="25" enum="BuiltinFunc">
+ Return the input snapped to a given step.
+ </constant>
+ <constant name="MATH_LERP" value="26" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ </constant>
+ <constant name="MATH_RANGE_LERP" value="28" enum="BuiltinFunc">
+ </constant>
+ <constant name="MATH_DECTIME" value="29" enum="BuiltinFunc">
+ Return the result of 'value' decreased by 'step' * 'amount'.
+ </constant>
+ <constant name="MATH_RANDOMIZE" value="30" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ 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" enum="BuiltinFunc">
+ Return a random floating-point value between the two inputs.
+ </constant>
+ <constant name="MATH_SEED" value="34" enum="BuiltinFunc">
+ Set the seed for the random number generator.
+ </constant>
+ <constant name="MATH_RANDSEED" value="35" enum="BuiltinFunc">
+ Return a random value from the given seed, along with the new seed.
+ </constant>
+ <constant name="MATH_DEG2RAD" value="36" enum="BuiltinFunc">
+ Convert the input from degrees to radians.
+ </constant>
+ <constant name="MATH_RAD2DEG" value="37" enum="BuiltinFunc">
+ Convert the input from radians to degrees.
+ </constant>
+ <constant name="MATH_LINEAR2DB" value="38" enum="BuiltinFunc">
+ Convert the input from linear volume to decibel volume.
+ </constant>
+ <constant name="MATH_DB2LINEAR" value="39" enum="BuiltinFunc">
+ Convert the input from decibel volume to linear volume.
+ </constant>
+ <constant name="MATH_POLAR2CARTESIAN" value="40" enum="BuiltinFunc">
+ Converts a 2D point expressed in the polar coordinate system (a distance from the origin [code]r[/code] and an angle [code]th[/code]) to the cartesian coordinate system (x and y axis).
+ </constant>
+ <constant name="MATH_CARTESIAN2POLAR" value="41" enum="BuiltinFunc">
+ Converts a 2D point expressed in the cartesian coordinate system (x and y axis) to the polar coordinate system (a distance from the origin and an angle).
+ </constant>
+ <constant name="MATH_WRAP" value="42" enum="BuiltinFunc">
+ </constant>
+ <constant name="MATH_WRAPF" value="43" enum="BuiltinFunc">
+ </constant>
+ <constant name="LOGIC_MAX" value="44" enum="BuiltinFunc">
+ Return the greater of the two numbers, also known as their maximum.
+ </constant>
+ <constant name="LOGIC_MIN" value="45" enum="BuiltinFunc">
+ Return the lesser of the two numbers, also known as their minimum.
+ </constant>
+ <constant name="LOGIC_CLAMP" value="46" enum="BuiltinFunc">
+ 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="47" enum="BuiltinFunc">
+ Return the nearest power of 2 to the input.
+ </constant>
+ <constant name="OBJ_WEAKREF" value="48" enum="BuiltinFunc">
+ Create a [WeakRef] from the input.
+ </constant>
+ <constant name="FUNC_FUNCREF" value="49" enum="BuiltinFunc">
+ Create a [FuncRef] from the input.
+ </constant>
+ <constant name="TYPE_CONVERT" value="50" enum="BuiltinFunc">
+ Convert between types.
+ </constant>
+ <constant name="TYPE_OF" value="51" enum="BuiltinFunc">
+ 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="52" enum="BuiltinFunc">
+ Checks if a type is registered in the [ClassDB].
+ </constant>
+ <constant name="TEXT_CHAR" value="53" enum="BuiltinFunc">
+ Return a character with the given ascii value.
+ </constant>
+ <constant name="TEXT_STR" value="54" enum="BuiltinFunc">
+ Convert the input to a string.
+ </constant>
+ <constant name="TEXT_PRINT" value="55" enum="BuiltinFunc">
+ Print the given string to the output window.
+ </constant>
+ <constant name="TEXT_PRINTERR" value="56" enum="BuiltinFunc">
+ Print the given string to the standard error output.
+ </constant>
+ <constant name="TEXT_PRINTRAW" value="57" enum="BuiltinFunc">
+ Print the given string to the standard output, without adding a newline.
+ </constant>
+ <constant name="VAR_TO_STR" value="58" enum="BuiltinFunc">
+ Serialize a [Variant] to a string.
+ </constant>
+ <constant name="STR_TO_VAR" value="59" enum="BuiltinFunc">
+ Deserialize a [Variant] from a string serialized using [VAR_TO_STR].
+ </constant>
+ <constant name="VAR_TO_BYTES" value="60" enum="BuiltinFunc">
+ Serialize a [Variant] to a [PoolByteArray].
+ </constant>
+ <constant name="BYTES_TO_VAR" value="61" enum="BuiltinFunc">
+ Deserialize a [Variant] from a [PoolByteArray] serialized using [VAR_TO_BYTES].
+ </constant>
+ <constant name="COLORN" value="62" enum="BuiltinFunc">
+ 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="63" enum="BuiltinFunc">
+ 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..2e3a5b33c0
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..a4a890ea8a
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptComment.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..353898c93a
--- /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.1">
+ <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..ed633c4135
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptConstant.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..14c44c6970
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ <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..b8e77a1b0f
--- /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.1">
+ <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" enum="StartMode">
+ The start mode used the first time when [method _step] is called.
+ </constant>
+ <constant name="START_MODE_CONTINUE_SEQUENCE" value="1" enum="StartMode">
+ 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" enum="StartMode">
+ The start mode used when [method _step] is called after resuming from STEP_YIELD_BIT.
+ </constant>
+ <constant name="STEP_PUSH_STACK_BIT" value="16777216">
+ 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">
+ 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">
+ </constant>
+ <constant name="STEP_EXIT_FUNCTION_BIT" value="134217728">
+ Hint used by [method _step] to tell that control should stop and exit the function.
+ </constant>
+ <constant name="STEP_YIELD_BIT" value="268435456">
+ 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..d3158df357
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </methods>
+ <members>
+ <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..fc49cfc07b
--- /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.1">
+ <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..4bb05525bd
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..93d7ce3516
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..343e83cb55
--- /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.1">
+ <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..ec8e955cf7
--- /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.1">
+ <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..f6116cf539
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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="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" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_BASIC_TYPE" value="3" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_SINGLETON" value="4" enum="CallMode">
+ </constant>
+ <constant name="RPC_DISABLED" value="0" enum="RPCCallMode">
+ </constant>
+ <constant name="RPC_RELIABLE" value="1" enum="RPCCallMode">
+ </constant>
+ <constant name="RPC_UNRELIABLE" value="2" enum="RPCCallMode">
+ </constant>
+ <constant name="RPC_RELIABLE_TO_ID" value="3" enum="RPCCallMode">
+ </constant>
+ <constant name="RPC_UNRELIABLE_TO_ID" value="4" enum="RPCCallMode">
+ </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..c75dd0cdbc
--- /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.1">
+ <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..9d43204f02
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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..73c1f47e1a
--- /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.1">
+ <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..652c29a9ac
--- /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.1">
+ <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..ab4c23012b
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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" enum="Mode">
+ </constant>
+ <constant name="MODE_RELEASED" value="1" enum="Mode">
+ </constant>
+ <constant name="MODE_JUST_PRESSED" value="2" enum="Mode">
+ </constant>
+ <constant name="MODE_JUST_RELEASED" value="3" enum="Mode">
+ </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..7090621bd7
--- /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.1">
+ <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..5c8ee6453c
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..f2e6c48907
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..df439f8794
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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" enum="MathConstant">
+ Unity: [code]1[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_PI" value="1" enum="MathConstant">
+ Pi: [code]3.141593[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_HALF_PI" value="2" enum="MathConstant">
+ Pi divided by two: [code]1.570796[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_TAU" value="3" enum="MathConstant">
+ Tau: [code]6.283185[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_E" value="4" enum="MathConstant">
+ Natural log: [code]2.718282[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_SQRT2" value="5" enum="MathConstant">
+ Square root of two: [code]1.414214[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_INF" value="6" enum="MathConstant">
+ Infinity: [code]inf[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_NAN" value="7" enum="MathConstant">
+ Not a number: [code]nan[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_MAX" value="8" enum="MathConstant">
+ </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..941a0cd91a
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptNode.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.1">
+ <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>
+ <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..e60d50c977
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptOperator.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..5a2886ccac
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptPreload.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..60cc8fdd4f
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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>
+ </members>
+ <constants>
+ <constant name="CALL_MODE_SELF" value="0" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
+ </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..8f29e9d152
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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>
+ </members>
+ <constants>
+ <constant name="CALL_MODE_SELF" value="0" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_BASIC_TYPE" value="3" enum="CallMode">
+ </constant>
+ <constant name="ASSIGN_OP_NONE" value="0" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_ADD" value="1" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_SUB" value="2" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_MUL" value="3" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_DIV" value="4" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_MOD" value="5" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_SHIFT_LEFT" value="6" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_SHIFT_RIGHT" value="7" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_AND" value="8" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_OR" value="9" enum="AssignOp">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_XOR" value="10" enum="AssignOp">
+ </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..f6300e03f0
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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..6095520eff
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptReturn.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..7704eaba04
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..2c2af9262d
--- /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.1">
+ <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..0731fc77e1
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSelect.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..61a73e104c
--- /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.1">
+ <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..c71e068045
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSequence.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..46aeebab9c
--- /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.1">
+ <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..a00811a29b
--- /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.1">
+ <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..0bdc4ce89d
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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..06178a399d
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..5969f25060
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.1">
+ <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>
+ </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..b9e7f6a553
--- /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.1">
+ <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..c4698f746a
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptYield.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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" enum="YieldMode">
+ </constant>
+ <constant name="YIELD_PHYSICS_FRAME" value="2" enum="YieldMode">
+ </constant>
+ <constant name="YIELD_WAIT" value="3" enum="YieldMode">
+ </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..b67e4ab1b8
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </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" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index c50ba17c35..2809cff362 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,8 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "register_types.h"
+#include "core/engine.h"
#include "io/resource_loader.h"
#include "visual_script.h"
#include "visual_script_builtin_funcs.h"
@@ -40,6 +42,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() {
@@ -49,7 +54,7 @@ void register_visual_script_types() {
ClassDB::register_class<VisualScript>();
ClassDB::register_virtual_class<VisualScriptNode>();
- ClassDB::register_virtual_class<VisualScriptFunctionState>();
+ ClassDB::register_class<VisualScriptFunctionState>();
ClassDB::register_class<VisualScriptFunction>();
ClassDB::register_class<VisualScriptOperator>();
ClassDB::register_class<VisualScriptVariableSet>();
@@ -107,6 +112,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 +128,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/register_types.h b/modules/visual_script/register_types.h
index 4fb03bc227..27b3bd649a 100644
--- a/modules/visual_script/register_types.h
+++ b/modules/visual_script/register_types.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,5 +27,6 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
void register_visual_script_types();
void unregister_visual_script_types();
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 765fe4c2f2..ef680547ca 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script.h"
#include "os/os.h"
@@ -129,7 +130,7 @@ void VisualScriptNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualScriptNode::_set_default_input_values);
ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualScriptNode::_get_default_input_values);
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_default_input_values", "_get_default_input_values");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_default_input_values", "_get_default_input_values");
ADD_SIGNAL(MethodInfo("ports_changed"));
}
@@ -1318,7 +1319,7 @@ void VisualScript::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_data", "data"), &VisualScript::_set_data);
ClassDB::bind_method(D_METHOD("_get_data"), &VisualScript::_get_data);
- ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
+ ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
ADD_SIGNAL(MethodInfo("node_ports_changed", PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::INT, "id")));
}
@@ -1434,7 +1435,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
if (!node->dependencies.empty()) {
int dc = node->dependencies.size();
- VisualScriptNodeInstance **deps = node->dependencies.ptr();
+ VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
@@ -1526,7 +1527,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
if (!node->dependencies.empty()) {
int dc = node->dependencies.size();
- VisualScriptNodeInstance **deps = node->dependencies.ptr();
+ VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
@@ -1626,7 +1627,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
state->flow_stack_pos = flow_stack_pos;
state->stack.resize(p_stack_size);
state->pass = p_pass;
- copymem(state->stack.ptr(), p_stack, p_stack_size);
+ copymem(state->stack.ptrw(), p_stack, p_stack_size);
//step 2, run away, return directly
r_error.error = Variant::CallError::CALL_OK;
@@ -2047,6 +2048,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
function.argument_count = func_node->get_argument_count();
function.max_stack += function.argument_count;
function.flow_stack_size = func_node->is_stack_less() ? 0 : func_node->get_stack_size();
+ max_input_args = MAX(max_input_args, function.argument_count);
}
//multiple passes are required to set up this complex thing..
@@ -2180,7 +2182,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
Ref<VisualScriptNode> node = F->get().node;
VisualScriptNodeInstance *instance = instances[F->key()];
- // conect to default values
+ // connect to default values
for (int i = 0; i < instance->input_port_count; i++) {
if (instance->input_ports[i] == -1) {
@@ -2190,7 +2192,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
}
}
- // conect to trash
+ // connect to trash
for (int i = 0; i < instance->output_port_count; i++) {
if (instance->output_ports[i] == -1) {
instance->output_ports[i] = function.trash_pos; //trash is same for all
@@ -2277,7 +2279,7 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
*working_mem = args; //arguments go to working mem.
- Variant ret = instance->_call_internal(function, stack.ptr(), stack.size(), node, flow_stack_pos, pass, true, r_error);
+ Variant ret = instance->_call_internal(function, stack.ptrw(), stack.size(), node, flow_stack_pos, pass, true, r_error);
function = StringName(); //invalidate
return ret;
}
@@ -2289,7 +2291,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p
binds.push_back(p_binds[i]);
}
binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing
- p_obj->connect(p_signal, this, "_signal_callback", binds);
+ p_obj->connect(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT);
}
bool VisualScriptFunctionState::is_valid() const {
@@ -2319,7 +2321,7 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
*working_mem = p_args; //arguments go to working mem.
- Variant ret = instance->_call_internal(function, stack.ptr(), stack.size(), node, flow_stack_pos, pass, true, r_error);
+ Variant ret = instance->_call_internal(function, stack.ptrw(), stack.size(), node, flow_stack_pos, pass, true, r_error);
function = StringName(); //invalidate
return ret;
}
@@ -2644,6 +2646,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 0f60b103c9..69bb522173 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,8 +27,9 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VSCRIPT_H
-#define VSCRIPT_H
+
+#ifndef VISUAL_SCRIPT_H
+#define VISUAL_SCRIPT_H
#include "os/thread.h"
#include "script_language.h"
@@ -600,6 +601,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);
@@ -616,4 +618,4 @@ static Ref<VisualScriptNode> create_node_generic(const String &p_name) {
return node;
}
-#endif // VSCRIPT_H
+#endif // VISUAL_SCRIPT_H
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 7c9d306831..7f0a42da82 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_builtin_funcs.h"
#include "class_db.h"
@@ -78,6 +79,8 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"rad2deg",
"linear2db",
"db2linear",
+ "polar2cartesian",
+ "cartesian2polar",
"wrapi",
"wrapf",
"max",
@@ -191,6 +194,8 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case MATH_EASE:
case MATH_STEPIFY:
case MATH_RANDOM:
+ case MATH_POLAR2CARTESIAN:
+ case MATH_CARTESIAN2POLAR:
case LOGIC_MAX:
case LOGIC_MIN:
case FUNC_FUNCREF:
@@ -252,10 +257,10 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_ASIN:
case MATH_ACOS:
case MATH_ATAN:
- case MATH_ATAN2:
case MATH_SQRT: {
- return PropertyInfo(Variant::REAL, "num");
+ return PropertyInfo(Variant::REAL, "s");
} break;
+ case MATH_ATAN2:
case MATH_FMOD:
case MATH_FPOSMOD: {
if (p_idx == 0)
@@ -268,7 +273,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_ROUND:
case MATH_ABS:
case MATH_SIGN: {
- return PropertyInfo(Variant::REAL, "num");
+ return PropertyInfo(Variant::REAL, "s");
} break;
@@ -282,7 +287,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_EXP:
case MATH_ISNAN:
case MATH_ISINF: {
- return PropertyInfo(Variant::REAL, "num");
+ return PropertyInfo(Variant::REAL, "s");
} break;
case MATH_EASE: {
if (p_idx == 0)
@@ -313,7 +318,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
else if (p_idx == 1)
return PropertyInfo(Variant::REAL, "to");
else
- return PropertyInfo(Variant::REAL, "value");
+ return PropertyInfo(Variant::REAL, "weight");
} break;
case MATH_RANGE_LERP: {
if (p_idx == 0)
@@ -368,6 +373,18 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_DB2LINEAR: {
return PropertyInfo(Variant::REAL, "db");
} break;
+ case MATH_POLAR2CARTESIAN: {
+ if (p_idx == 0)
+ return PropertyInfo(Variant::REAL, "r");
+ else
+ return PropertyInfo(Variant::REAL, "th");
+ } break;
+ case MATH_CARTESIAN2POLAR: {
+ if (p_idx == 0)
+ return PropertyInfo(Variant::REAL, "x");
+ else
+ return PropertyInfo(Variant::REAL, "y");
+ } break;
case MATH_WRAP: {
if (p_idx == 0)
return PropertyInfo(Variant::INT, "value");
@@ -398,14 +415,14 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
} break;
case LOGIC_CLAMP: {
if (p_idx == 0)
- return PropertyInfo(Variant::REAL, "a");
- else if (p_idx == 0) // FIXME: is it ok to test p_idx == 0 twice?
+ return PropertyInfo(Variant::REAL, "value");
+ else if (p_idx == 1)
return PropertyInfo(Variant::REAL, "min");
else
return PropertyInfo(Variant::REAL, "max");
} break;
case LOGIC_NEAREST_PO2: {
- return PropertyInfo(Variant::INT, "num");
+ return PropertyInfo(Variant::INT, "value");
} break;
case OBJ_WEAKREF: {
@@ -573,6 +590,10 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
case MATH_DB2LINEAR: {
t = Variant::REAL;
} break;
+ case MATH_POLAR2CARTESIAN:
+ case MATH_CARTESIAN2POLAR: {
+ t = Variant::VECTOR2;
+ } break;
case MATH_WRAP: {
t = Variant::INT;
} break;
@@ -922,6 +943,20 @@ 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_POLAR2CARTESIAN: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ double r = *p_inputs[0];
+ double th = *p_inputs[1];
+ *r_return = Vector2(r * Math::cos(th), r * Math::sin(th));
+ } break;
+ case VisualScriptBuiltinFunc::MATH_CARTESIAN2POLAR: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ double x = *p_inputs[0];
+ double y = *p_inputs[1];
+ *r_return = Vector2(Math::sqrt(x * x + y * y), Math::atan2(y, x));
+ } break;
case VisualScriptBuiltinFunc::MATH_WRAP: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
@@ -1109,7 +1144,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: {
@@ -1294,6 +1329,8 @@ void VisualScriptBuiltinFunc::_bind_methods() {
BIND_ENUM_CONSTANT(MATH_RAD2DEG);
BIND_ENUM_CONSTANT(MATH_LINEAR2DB);
BIND_ENUM_CONSTANT(MATH_DB2LINEAR);
+ BIND_ENUM_CONSTANT(MATH_POLAR2CARTESIAN);
+ BIND_ENUM_CONSTANT(MATH_CARTESIAN2POLAR);
BIND_ENUM_CONSTANT(MATH_WRAP);
BIND_ENUM_CONSTANT(MATH_WRAPF);
BIND_ENUM_CONSTANT(LOGIC_MAX);
@@ -1381,6 +1418,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/polar2cartesian", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_POLAR2CARTESIAN>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/cartesian2polar", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_CARTESIAN2POLAR>);
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>);
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index 34a2825938..f862d5c26f 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUAL_SCRIPT_BUILTIN_FUNCS_H
#define VISUAL_SCRIPT_BUILTIN_FUNCS_H
@@ -77,6 +78,8 @@ public:
MATH_RAD2DEG,
MATH_LINEAR2DB,
MATH_DB2LINEAR,
+ MATH_POLAR2CARTESIAN,
+ MATH_CARTESIAN2POLAR,
MATH_WRAP,
MATH_WRAPF,
LOGIC_MAX,
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 03015df844..69503e631c 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,8 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_editor.h"
+#include "core/script_language.h"
#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
#include "os/input.h"
@@ -227,7 +229,7 @@ protected:
if (String(p_name) == "type") {
- Dictionary dc = d.copy();
+ Dictionary dc = d.duplicate();
dc["type"] = p_value;
undo_redo->create_action(TTR("Set Variable Type"));
undo_redo->add_do_method(script.ptr(), "set_variable_info", var, dc);
@@ -240,7 +242,7 @@ protected:
if (String(p_name) == "hint") {
- Dictionary dc = d.copy();
+ Dictionary dc = d.duplicate();
dc["hint"] = p_value;
undo_redo->create_action(TTR("Set Variable Type"));
undo_redo->add_do_method(script.ptr(), "set_variable_info", var, dc);
@@ -253,7 +255,7 @@ protected:
if (String(p_name) == "hint_string") {
- Dictionary dc = d.copy();
+ Dictionary dc = d.duplicate();
dc["hint_string"] = p_value;
undo_redo->create_action(TTR("Set Variable Type"));
undo_redo->add_do_method(script.ptr(), "set_variable_info", var, dc);
@@ -316,7 +318,8 @@ protected:
}
p_list->push_back(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt));
p_list->push_back(PropertyInfo(script->get_variable_info(var).type, "value", script->get_variable_info(var).hint, script->get_variable_info(var).hint_string, PROPERTY_USAGE_DEFAULT));
- p_list->push_back(PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_ENUM, "None,Range,ExpRange,Enum,ExpEasing,Length,SpriteFrame,KeyAccel,BitFlags,AllFlags,File,Dir,GlobalFile,GlobalDir,ResourceType,MultilineText"));
+ // Update this when PropertyHint changes
+ p_list->push_back(PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_ENUM, "None,Range,ExpRange,Enum,ExpEasing,Length,SpriteFrame,KeyAccel,Flags,Layers2dRender,Layers2dPhysics,Layer3dRender,Layer3dPhysics,File,Dir,GlobalFile,GlobalDir,ResourceType,MultilineText,ColorNoAlpha,ImageCompressLossy,ImageCompressLossLess,ObjectId,String,NodePathToEditedNode,MethodOfVariantType,MethodOfBaseType,MethodOfInstance,MethodOfScript,PropertyOfVariantType,PropertyOfBaseType,PropertyOfInstance,PropertyOfScript,ObjectTooBig"));
p_list->push_back(PropertyInfo(Variant::STRING, "hint_string"));
p_list->push_back(PropertyInfo(Variant::BOOL, "export"));
}
@@ -348,7 +351,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 +388,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;
@@ -479,33 +482,33 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
select_func_text->hide();
Ref<Texture> type_icons[Variant::VARIANT_MAX] = {
- Control::get_icon("MiniVariant", "EditorIcons"),
- Control::get_icon("MiniBoolean", "EditorIcons"),
- Control::get_icon("MiniInteger", "EditorIcons"),
- Control::get_icon("MiniFloat", "EditorIcons"),
- Control::get_icon("MiniString", "EditorIcons"),
- Control::get_icon("MiniVector2", "EditorIcons"),
- Control::get_icon("MiniRect2", "EditorIcons"),
- Control::get_icon("MiniVector3", "EditorIcons"),
- Control::get_icon("MiniTransform2D", "EditorIcons"),
- Control::get_icon("MiniPlane", "EditorIcons"),
- Control::get_icon("MiniQuat", "EditorIcons"),
- Control::get_icon("MiniAabb", "EditorIcons"),
- Control::get_icon("MiniBasis", "EditorIcons"),
- Control::get_icon("MiniTransform", "EditorIcons"),
- Control::get_icon("MiniColor", "EditorIcons"),
- Control::get_icon("MiniPath", "EditorIcons"),
- Control::get_icon("MiniRid", "EditorIcons"),
+ Control::get_icon("Variant", "EditorIcons"),
+ Control::get_icon("bool", "EditorIcons"),
+ Control::get_icon("int", "EditorIcons"),
+ Control::get_icon("float", "EditorIcons"),
+ Control::get_icon("String", "EditorIcons"),
+ Control::get_icon("Vector2", "EditorIcons"),
+ Control::get_icon("Rect2", "EditorIcons"),
+ Control::get_icon("Vector3", "EditorIcons"),
+ Control::get_icon("Transform2D", "EditorIcons"),
+ Control::get_icon("Plane", "EditorIcons"),
+ Control::get_icon("Quat", "EditorIcons"),
+ Control::get_icon("AABB", "EditorIcons"),
+ Control::get_icon("Basis", "EditorIcons"),
+ Control::get_icon("Transform", "EditorIcons"),
+ Control::get_icon("Color", "EditorIcons"),
+ Control::get_icon("NodePath", "EditorIcons"),
+ Control::get_icon("RID", "EditorIcons"),
Control::get_icon("MiniObject", "EditorIcons"),
- Control::get_icon("MiniDictionary", "EditorIcons"),
- Control::get_icon("MiniArray", "EditorIcons"),
- Control::get_icon("MiniRawArray", "EditorIcons"),
- Control::get_icon("MiniIntArray", "EditorIcons"),
- Control::get_icon("MiniFloatArray", "EditorIcons"),
- Control::get_icon("MiniStringArray", "EditorIcons"),
- Control::get_icon("MiniVector2Array", "EditorIcons"),
- Control::get_icon("MiniVector3Array", "EditorIcons"),
- Control::get_icon("MiniColorArray", "EditorIcons")
+ Control::get_icon("Dictionary", "EditorIcons"),
+ Control::get_icon("Array", "EditorIcons"),
+ Control::get_icon("PoolByteArray", "EditorIcons"),
+ Control::get_icon("PoolIntArray", "EditorIcons"),
+ Control::get_icon("PoolRealArray", "EditorIcons"),
+ Control::get_icon("PoolStringArray", "EditorIcons"),
+ Control::get_icon("PoolVector2Array", "EditorIcons"),
+ Control::get_icon("PoolVector3Array", "EditorIcons"),
+ Control::get_icon("PoolColorArray", "EditorIcons")
};
Ref<Texture> seq_port = Control::get_icon("VisualShaderPort", "EditorIcons");
@@ -773,33 +776,33 @@ void VisualScriptEditor::_update_members() {
variables->set_custom_color(0, Control::get_color("mono_color", "Editor"));
Ref<Texture> type_icons[Variant::VARIANT_MAX] = {
- Control::get_icon("MiniVariant", "EditorIcons"),
- Control::get_icon("MiniBoolean", "EditorIcons"),
- Control::get_icon("MiniInteger", "EditorIcons"),
- Control::get_icon("MiniFloat", "EditorIcons"),
- Control::get_icon("MiniString", "EditorIcons"),
- Control::get_icon("MiniVector2", "EditorIcons"),
- Control::get_icon("MiniRect2", "EditorIcons"),
- Control::get_icon("MiniVector3", "EditorIcons"),
- Control::get_icon("MiniMatrix32", "EditorIcons"),
- Control::get_icon("MiniPlane", "EditorIcons"),
- Control::get_icon("MiniQuat", "EditorIcons"),
- Control::get_icon("MiniAabb", "EditorIcons"),
- Control::get_icon("MiniMatrix3", "EditorIcons"),
- Control::get_icon("MiniTransform", "EditorIcons"),
- Control::get_icon("MiniColor", "EditorIcons"),
- Control::get_icon("MiniPath", "EditorIcons"),
- Control::get_icon("MiniRid", "EditorIcons"),
+ Control::get_icon("Variant", "EditorIcons"),
+ Control::get_icon("bool", "EditorIcons"),
+ Control::get_icon("int", "EditorIcons"),
+ Control::get_icon("float", "EditorIcons"),
+ Control::get_icon("String", "EditorIcons"),
+ Control::get_icon("Vector2", "EditorIcons"),
+ Control::get_icon("Rect2", "EditorIcons"),
+ Control::get_icon("Vector3", "EditorIcons"),
+ Control::get_icon("Transform2D", "EditorIcons"),
+ Control::get_icon("Plane", "EditorIcons"),
+ Control::get_icon("Quat", "EditorIcons"),
+ Control::get_icon("AABB", "EditorIcons"),
+ Control::get_icon("Basis", "EditorIcons"),
+ Control::get_icon("Transform", "EditorIcons"),
+ Control::get_icon("Color", "EditorIcons"),
+ Control::get_icon("NodePath", "EditorIcons"),
+ Control::get_icon("RID", "EditorIcons"),
Control::get_icon("MiniObject", "EditorIcons"),
- Control::get_icon("MiniDictionary", "EditorIcons"),
- Control::get_icon("MiniArray", "EditorIcons"),
- Control::get_icon("MiniRawArray", "EditorIcons"),
- Control::get_icon("MiniIntArray", "EditorIcons"),
- Control::get_icon("MiniFloatArray", "EditorIcons"),
- Control::get_icon("MiniStringArray", "EditorIcons"),
- Control::get_icon("MiniVector2Array", "EditorIcons"),
- Control::get_icon("MiniVector3Array", "EditorIcons"),
- Control::get_icon("MiniColorArray", "EditorIcons")
+ Control::get_icon("Dictionary", "EditorIcons"),
+ Control::get_icon("Array", "EditorIcons"),
+ Control::get_icon("PoolByteArray", "EditorIcons"),
+ Control::get_icon("PoolIntArray", "EditorIcons"),
+ Control::get_icon("PoolRealArray", "EditorIcons"),
+ Control::get_icon("PoolStringArray", "EditorIcons"),
+ Control::get_icon("PoolVector2Array", "EditorIcons"),
+ Control::get_icon("PoolVector3Array", "EditorIcons"),
+ Control::get_icon("PoolColorArray", "EditorIcons")
};
List<StringName> var_names;
@@ -1305,6 +1308,35 @@ void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
}
}
+void VisualScriptEditor::_members_gui_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventKey> key = p_event;
+ if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
+ if (members->has_focus()) {
+ TreeItem *ti = members->get_selected();
+ if (ti) {
+ TreeItem *root = members->get_root();
+ if (ti->get_parent() == root->get_children()) {
+ member_type = MEMBER_FUNCTION;
+ }
+ if (ti->get_parent() == root->get_children()->get_next()) {
+ member_type = MEMBER_VARIABLE;
+ }
+ if (ti->get_parent() == root->get_children()->get_next()->get_next()) {
+ member_type = MEMBER_SIGNAL;
+ }
+ member_name = ti->get_text(0);
+ }
+ if (ED_IS_SHORTCUT("visual_script_editor/delete_selected", p_event)) {
+ _member_option(MEMBER_REMOVE);
+ }
+ if (ED_IS_SHORTCUT("visual_script_editor/edit_member", p_event)) {
+ _member_option(MEMBER_EDIT);
+ }
+ }
+ }
+}
+
Variant VisualScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
if (p_from == nodes) {
@@ -1388,7 +1420,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
if (String(d["type"]) == "obj_property") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Meta to drop a Getter. Hold Shift to drop a generic signature."));
+ const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Getter. Hold Shift to drop a generic signature."), find_keycode_name(KEY_META)));
#else
const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."));
#endif
@@ -1397,7 +1429,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
if (String(d["type"]) == "nodes") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Meta to drop a simple reference to the node."));
+ const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a simple reference to the node."), find_keycode_name(KEY_META)));
#else
const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a simple reference to the node."));
#endif
@@ -1406,7 +1438,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
if (String(d["type"]) == "visual_script_variable_drag") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Meta to drop a Variable Setter."));
+ const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Variable Setter."), find_keycode_name(KEY_META)));
#else
const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a Variable Setter."));
#endif
@@ -2465,7 +2497,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_port_ac
in_guesses.push_back(g);
}
- return node->guess_output_type(in_guesses.ptr(), p_port_action_output);
+ return node->guess_output_type(in_guesses.ptrw(), p_port_action_output);
}
void VisualScriptEditor::_port_action_menu(int p_option) {
@@ -2764,6 +2796,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();
@@ -3070,7 +3119,7 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) {
member_type = MEMBER_FUNCTION;
member_name = ti->get_text(0);
- member_popup->add_icon_item(del_icon, TTR("Remove Function"), MEMBER_REMOVE);
+ member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("visual_script_editor/delete_selected"), MEMBER_REMOVE);
member_popup->popup();
return;
}
@@ -3079,9 +3128,9 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) {
member_type = MEMBER_VARIABLE;
member_name = ti->get_text(0);
- member_popup->add_icon_item(edit_icon, TTR("Edit Variable"), MEMBER_EDIT);
+ member_popup->add_icon_shortcut(edit_icon, ED_GET_SHORTCUT("visual_script_editor/edit_member"), MEMBER_EDIT);
member_popup->add_separator();
- member_popup->add_icon_item(del_icon, TTR("Remove Variable"), MEMBER_REMOVE);
+ member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("visual_script_editor/delete_selected"), MEMBER_REMOVE);
member_popup->popup();
return;
}
@@ -3090,9 +3139,9 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) {
member_type = MEMBER_SIGNAL;
member_name = ti->get_text(0);
- member_popup->add_icon_item(edit_icon, TTR("Edit Signal"), MEMBER_EDIT);
+ member_popup->add_icon_shortcut(edit_icon, ED_GET_SHORTCUT("visual_script_editor/edit_member"), MEMBER_EDIT);
member_popup->add_separator();
- member_popup->add_icon_item(del_icon, TTR("Remove Signal"), MEMBER_REMOVE);
+ member_popup->add_icon_shortcut(del_icon, ED_GET_SHORTCUT("visual_script_editor/delete_selected"), MEMBER_REMOVE);
member_popup->popup();
return;
}
@@ -3223,6 +3272,7 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("drop_data_fw", &VisualScriptEditor::drop_data_fw);
ClassDB::bind_method("_input", &VisualScriptEditor::_input);
+ ClassDB::bind_method("_members_gui_input", &VisualScriptEditor::_members_gui_input);
ClassDB::bind_method("_on_nodes_delete", &VisualScriptEditor::_on_nodes_delete);
ClassDB::bind_method("_on_nodes_duplicate", &VisualScriptEditor::_on_nodes_duplicate);
@@ -3241,6 +3291,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() {
@@ -3283,6 +3335,7 @@ VisualScriptEditor::VisualScriptEditor() {
members->connect("button_pressed", this, "_member_button");
members->connect("item_edited", this, "_member_edited");
members->connect("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED);
+ members->connect("gui_input", this, "_members_gui_input");
members->set_allow_reselect(true);
members->set_hide_folding(true);
members->set_drag_forwarding(this);
@@ -3425,6 +3478,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() {
@@ -3454,12 +3509,13 @@ static void register_editor_callback() {
ScriptEditor::register_create_script_editor_function(create_editor);
- ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected"));
+ ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected"), KEY_DELETE);
ED_SHORTCUT("visual_script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
ED_SHORTCUT("visual_script_editor/find_node_type", TTR("Find Node Type"), KEY_MASK_CMD + KEY_F);
ED_SHORTCUT("visual_script_editor/copy_nodes", TTR("Copy Nodes"), KEY_MASK_CMD + KEY_C);
ED_SHORTCUT("visual_script_editor/cut_nodes", TTR("Cut Nodes"), KEY_MASK_CMD + KEY_X);
ED_SHORTCUT("visual_script_editor/paste_nodes", TTR("Paste Nodes"), KEY_MASK_CMD + KEY_V);
+ ED_SHORTCUT("visual_script_editor/edit_member", TTR("Edit Member"), KEY_MASK_CMD + KEY_E);
}
void VisualScriptEditor::register_editor() {
@@ -3468,4 +3524,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..80bbf142d9 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUALSCRIPT_EDITOR_H
#define VISUALSCRIPT_EDITOR_H
@@ -210,6 +211,7 @@ class VisualScriptEditor : public ScriptEditorBase {
String revert_on_drag;
void _input(const Ref<InputEvent> &p_event);
+ void _members_gui_input(const Ref<InputEvent> &p_event);
void _on_nodes_delete();
void _on_nodes_duplicate();
@@ -278,6 +280,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..16de04e4cf 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_expression.h"
bool VisualScriptExpression::_set(const StringName &p_name, const Variant &p_value) {
@@ -564,6 +565,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;
@@ -1375,7 +1379,7 @@ public:
argp[i] = &arr[i];
}
- r_ret = Variant::construct(constructor->data_type, argp.ptr(), argp.size(), ce);
+ r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
@@ -1402,7 +1406,7 @@ public:
argp[i] = &arr[i];
}
- VisualScriptBuiltinFunc::exec_func(bifunc->func, argp.ptr(), &r_ret, ce, r_error_str);
+ VisualScriptBuiltinFunc::exec_func(bifunc->func, (const Variant **)argp.ptr(), &r_ret, ce, r_error_str);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "Builtin Call Failed. " + r_error_str;
@@ -1434,7 +1438,7 @@ public:
argp[i] = &arr[i];
}
- r_ret = base.call(call->method, argp.ptr(), argp.size(), ce);
+ r_ret = base.call(call->method, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "On call to '" + String(call->method) + "':";
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index 2636e79842..1f41e442c5 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUALSCRIPTEXPRESSION_H
#define VISUALSCRIPTEXPRESSION_H
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 59d9540239..5c097dfa76 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_flow_control.h"
#include "io/resource_loader.h"
@@ -732,921 +733,6 @@ VisualScriptSwitch::VisualScriptSwitch() {
}
//////////////////////////////////////////
-////////////////EVENT ACTION FILTER///////////
-//////////////////////////////////////////
-
-#if 0
-int VisualScriptInputFilter::get_output_sequence_port_count() const {
-
- return filters.size();
-}
-
-bool VisualScriptInputFilter::has_input_sequence_port() const {
-
- return true;
-}
-
-int VisualScriptInputFilter::get_input_value_port_count() const {
-
- return 1;
-}
-int VisualScriptInputFilter::get_output_value_port_count() const {
-
- return 1;
-}
-
-String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const {
-
- String text;
-
- switch (filters[p_port].type) {
- case Ref<InputEvent>::NONE: {
- text = "None";
- } break;
- case Ref<InputEvent>::KEY: {
-
- InputEventKey k = filters[p_port].key;
-
- if (k->get_scancode() == 0 && k.unicode == 0) {
- text = "No Key";
- } else {
- if (k->get_scancode() != 0) {
- text = "KeyCode: " + keycode_get_string(k->get_scancode());
- } else if (k.unicode != 0) {
- text = "Uniode: " + String::chr(k.unicode);
- }
-
- if (k->is_pressed())
- text += ", Pressed";
- else
- text += ", Released";
-
- if (k.echo)
- text += ", Echo";
- if (k->get_alt())
- text = "Alt+" + text;
- if (k->get_shift())
- text = "Shift+" + text;
- if (k->get_control())
- text = "Ctrl+" + text;
- if (k->get_metakey())
- text = "Meta+" + text;
- }
-
- } break;
- case Ref<InputEvent>::MOUSE_MOTION: {
- InputEventMouseMotion mm = filters[p_port].mouse_motion;
- text = "Mouse Motion";
-
- String b = "Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight";
-
- for (int i = 0; i < 7; i++) {
- if (mm->get_button_mask() & (1 << i)) {
- text = b.get_slice(",", i) + "+" + text;
- }
- }
- if (mm->get_alt())
- text = "Alt+" + text;
- if (mm->get_shift())
- text = "Shift+" + text;
- if (mm->get_control())
- text = "Ctrl+" + text;
- if (mm->get_metakey())
- text = "Meta+" + text;
- } break;
- case Ref<InputEvent>::MOUSE_BUTTON: {
-
- InputEventMouseButton mb = filters[p_port].mouse_button;
-
- String b = "Any,Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight";
-
- text = b.get_slice(",", mb->get_button_index()) + " Mouse Button";
-
- if (mb->is_pressed())
- text += ", Pressed";
- else
- text += ", Released";
-
- if (mb.doubleclick)
- text += ", DblClick";
- if (mb->get_alt())
- text = "Alt+" + text;
- if (mb->get_shift())
- text = "Shift+" + text;
- if (mb->get_control())
- text = "Ctrl+" + text;
- if (mb->get_metakey())
- text = "Meta+" + text;
-
- } break;
- case Ref<InputEvent>::JOYPAD_MOTION: {
-
- InputEventJoypadMotion jm = filters[p_port].joy_motion;
-
- text = "JoyMotion Axis " + itos(jm.axis >> 1);
- if (jm.axis & 1)
- text += " > " + rtos(jm.axis_value);
- else
- text += " < " + rtos(-jm.axis_value);
-
- } break;
- case Ref<InputEvent>::JOYPAD_BUTTON: {
- InputEventJoypadButton jb = filters[p_port].joy_button;
-
- text = "JoyButton " + itos(jb->get_button_index());
- if (jb->is_pressed())
- text += ", Pressed";
- else
- text += ", Released";
- } break;
- case Ref<InputEvent>::SCREEN_TOUCH: {
- InputEventScreenTouch sd = filters[p_port].screen_touch;
-
- text = "Touch Finger " + itos(sd.index);
- if (sd->is_pressed())
- text += ", Pressed";
- else
- text += ", Released";
- } break;
- case Ref<InputEvent>::SCREEN_DRAG: {
- InputEventScreenDrag sd = filters[p_port].screen_drag;
- text = "Drag Finger " + itos(sd.index);
- } break;
- case Ref<InputEvent>::ACTION: {
-
- List<PropertyInfo> pinfo;
- ProjectSettings::get_singleton()->get_property_list(&pinfo);
- int index = 1;
-
- text = "No Action";
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
- const PropertyInfo &pi = E->get();
-
- if (!pi.name.begins_with("input/"))
- continue;
-
- if (filters[p_port].action.action == index) {
- text = "Action " + pi.name.substr(pi.name.find("/") + 1, pi.name.length());
- break;
- }
- index++;
- }
-
- if (filters[p_port].action->is_pressed())
- text += ", Pressed";
- else
- text += ", Released";
-
- } break;
- }
-
- return text + " - " + itos(p_port);
-}
-
-PropertyInfo VisualScriptInputFilter::get_input_value_port_info(int p_idx) const {
-
- return PropertyInfo(Variant::INPUT_EVENT, "event");
-}
-
-PropertyInfo VisualScriptInputFilter::get_output_value_port_info(int p_idx) const {
-
- return PropertyInfo(Variant::INPUT_EVENT, "");
-}
-
-String VisualScriptInputFilter::get_caption() const {
-
- return "InputFilter";
-}
-
-String VisualScriptInputFilter::get_text() const {
-
- return "";
-}
-
-bool VisualScriptInputFilter::_set(const StringName &p_name, const Variant &p_value) {
-
- if (p_name == "filter_count") {
- filters.resize(p_value);
- _change_notify();
- ports_changed_notify();
- return true;
- }
-
- if (String(p_name).begins_with("filter_")) {
-
- int idx = String(p_name).replace_first("filters_", "").get_slice("/", 0).to_int();
-
- ERR_FAIL_INDEX_V(idx, filters.size(), false);
-
- String what = String(p_name).get_slice("/", 1);
-
- if (what == "type") {
- filters[idx] = Ref<InputEvent>();
- filters[idx].type = Ref<InputEvent>::Type(int(p_value));
- if (filters[idx].type == Ref<InputEvent>::JOYPAD_MOTION) {
- filters[idx].joy_motion.axis_value = 0.5; //for threshold
- } else if (filters[idx].type == Ref<InputEvent>::KEY) {
- filters[idx]->is_pressed() = true; //put these as true to make it more user friendly
- } else if (filters[idx].type == Ref<InputEvent>::MOUSE_BUTTON) {
- filters[idx]->is_pressed() = true;
- } else if (filters[idx].type == Ref<InputEvent>::JOYPAD_BUTTON) {
- filters[idx].joy_button->is_pressed() = true;
- } else if (filters[idx].type == Ref<InputEvent>::SCREEN_TOUCH) {
- filters[idx].screen_touch->is_pressed() = true;
- } else if (filters[idx].type == Ref<InputEvent>::ACTION) {
- filters[idx].action->is_pressed() = true;
- }
- _change_notify();
- ports_changed_notify();
-
- return true;
- }
- if (what == "device") {
- filters[idx].device = p_value;
- ports_changed_notify();
- return true;
- }
-
- switch (filters[idx].type) {
-
- case Ref<InputEvent>::KEY: {
-
- if (what == "scancode") {
- String sc = p_value;
- if (sc == String()) {
- filters[idx]->get_scancode() = 0;
- } else {
- filters[idx]->get_scancode() = find_keycode(p_value);
- }
-
- } else if (what == "unicode") {
-
- String uc = p_value;
-
- if (uc == String()) {
- filters[idx].key.unicode = 0;
- } else {
- filters[idx].key.unicode = uc[0];
- }
-
- } else if (what == "pressed") {
-
- filters[idx]->is_pressed() = p_value;
- } else if (what == "echo") {
-
- filters[idx]->is_echo() = p_value;
-
- } else if (what == "mod_alt") {
- filters[idx]->get_alt() = p_value;
-
- } else if (what == "mod_shift") {
- filters[idx]->get_shift() = p_value;
-
- } else if (what == "mod_ctrl") {
- filters[idx]->get_control() = p_value;
-
- } else if (what == "mod_meta") {
- filters[idx]->get_metakey() = p_value;
- } else {
- return false;
- }
- ports_changed_notify();
-
- return true;
- } break;
- case Ref<InputEvent>::MOUSE_MOTION: {
-
- if (what == "button_mask") {
- filters[idx]->get_button_mask() = p_value;
-
- } else if (what == "mod_alt") {
- filters[idx].mouse_motion->get_alt() = p_value;
-
- } else if (what == "mod_shift") {
- filters[idx].mouse_motion->get_shift() = p_value;
-
- } else if (what == "mod_ctrl") {
- filters[idx].mouse_motion->get_control() = p_value;
-
- } else if (what == "mod_meta") {
- filters[idx].mouse_motion->get_metakey() = p_value;
- } else {
- return false;
- }
-
- ports_changed_notify();
- return true;
-
- } break;
- case Ref<InputEvent>::MOUSE_BUTTON: {
-
- if (what == "button_index") {
- filters[idx]->get_button_index() = p_value;
- } else if (what == "pressed") {
- filters[idx]->is_pressed() = p_value;
- } else if (what == "doubleclicked") {
- filters[idx].mouse_button.doubleclick = p_value;
-
- } else if (what == "mod_alt") {
- filters[idx].mouse_button->get_alt() = p_value;
-
- } else if (what == "mod_shift") {
- filters[idx].mouse_button->get_shift() = p_value;
-
- } else if (what == "mod_ctrl") {
- filters[idx].mouse_button->get_control() = p_value;
-
- } else if (what == "mod_meta") {
- filters[idx].mouse_button->get_metakey() = p_value;
- } else {
- return false;
- }
- ports_changed_notify();
- return true;
-
- } break;
- case Ref<InputEvent>::JOYPAD_MOTION: {
-
- if (what == "axis") {
- filters[idx].joy_motion.axis = int(p_value) << 1 | filters[idx].joy_motion.axis;
- } else if (what == "mode") {
- filters[idx].joy_motion.axis |= int(p_value);
- } else if (what == "threshold") {
- filters[idx].joy_motion.axis_value = p_value;
- } else {
- return false;
- }
- ports_changed_notify();
- return true;
-
- } break;
- case Ref<InputEvent>::JOYPAD_BUTTON: {
-
- if (what == "button_index") {
- filters[idx].joy_button->get_button_index() = p_value;
- } else if (what == "pressed") {
- filters[idx].joy_button->is_pressed() = p_value;
- } else {
- return false;
- }
- ports_changed_notify();
- return true;
-
- } break;
- case Ref<InputEvent>::SCREEN_TOUCH: {
-
- if (what == "finger_index") {
- filters[idx].screen_touch.index = p_value;
- } else if (what == "pressed") {
- filters[idx].screen_touch->is_pressed() = p_value;
- } else {
- return false;
- }
- ports_changed_notify();
- return true;
- } break;
- case Ref<InputEvent>::SCREEN_DRAG: {
- if (what == "finger_index") {
- filters[idx].screen_drag.index = p_value;
- } else {
- return false;
- }
- ports_changed_notify();
- return true;
- } break;
- case Ref<InputEvent>::ACTION: {
-
- if (what == "action_name") {
-
- List<PropertyInfo> pinfo;
- ProjectSettings::get_singleton()->get_property_list(&pinfo);
- int index = 1;
-
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
- const PropertyInfo &pi = E->get();
-
- if (!pi.name.begins_with("input/"))
- continue;
-
- String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
- if (name == String(p_value)) {
-
- filters[idx].action.action = index;
- ports_changed_notify();
- return true;
- }
-
- index++;
- }
-
- filters[idx].action.action = 0;
- ports_changed_notify();
-
- return false;
-
- } else if (what == "pressed") {
-
- filters[idx].action->is_pressed() = p_value;
- ports_changed_notify();
- return true;
- }
-
- } break;
- }
- }
- return false;
-}
-
-bool VisualScriptInputFilter::_get(const StringName &p_name, Variant &r_ret) const {
-
- if (p_name == "filter_count") {
- r_ret = filters.size();
- return true;
- }
-
- if (String(p_name).begins_with("filter_")) {
-
- int idx = String(p_name).replace_first("filters_", "").get_slice("/", 0).to_int();
-
- ERR_FAIL_INDEX_V(idx, filters.size(), false);
-
- String what = String(p_name).get_slice("/", 1);
-
- if (what == "type") {
- r_ret = filters[idx].type;
- return true;
- }
- if (what == "device") {
- r_ret = filters[idx].device;
- return true;
- }
-
- switch (filters[idx].type) {
-
- case Ref<InputEvent>::KEY: {
-
- if (what == "scancode") {
- if (filters[idx]->get_scancode() == 0)
- r_ret = String();
- else {
-
- r_ret = keycode_get_string(filters[idx]->get_scancode());
- }
-
- } else if (what == "unicode") {
-
- if (filters[idx].key.unicode == 0) {
- r_ret = String();
- } else {
- CharType str[2] = { (CharType)filters[idx].key.unicode, 0 };
- r_ret = String(str);
- }
-
- } else if (what == "pressed") {
-
- r_ret = filters[idx]->is_pressed();
- } else if (what == "echo") {
-
- r_ret = filters[idx]->is_echo();
-
- } else if (what == "mod_alt") {
- r_ret = filters[idx]->get_alt();
-
- } else if (what == "mod_shift") {
- r_ret = filters[idx]->get_shift();
-
- } else if (what == "mod_ctrl") {
- r_ret = filters[idx]->get_control();
-
- } else if (what == "mod_meta") {
- r_ret = filters[idx]->get_metakey();
- } else {
- return false;
- }
-
- return true;
- } break;
- case Ref<InputEvent>::MOUSE_MOTION: {
-
- if (what == "button_mask") {
- r_ret = filters[idx]->get_button_mask();
-
- } else if (what == "mod_alt") {
- r_ret = filters[idx].mouse_motion->get_alt();
-
- } else if (what == "mod_shift") {
- r_ret = filters[idx].mouse_motion->get_shift();
-
- } else if (what == "mod_ctrl") {
- r_ret = filters[idx].mouse_motion->get_control();
-
- } else if (what == "mod_meta") {
- r_ret = filters[idx].mouse_motion->get_metakey();
- } else {
- return false;
- }
-
- return true;
-
- } break;
- case Ref<InputEvent>::MOUSE_BUTTON: {
-
- if (what == "button_index") {
- r_ret = filters[idx]->get_button_index();
- } else if (what == "pressed") {
- r_ret = filters[idx]->is_pressed();
- } else if (what == "doubleclicked") {
- r_ret = filters[idx].mouse_button.doubleclick;
-
- } else if (what == "mod_alt") {
- r_ret = filters[idx].mouse_button->get_alt();
-
- } else if (what == "mod_shift") {
- r_ret = filters[idx].mouse_button->get_shift();
-
- } else if (what == "mod_ctrl") {
- r_ret = filters[idx].mouse_button->get_control();
-
- } else if (what == "mod_meta") {
- r_ret = filters[idx].mouse_button->get_metakey();
- } else {
- return false;
- }
- return true;
-
- } break;
- case Ref<InputEvent>::JOYPAD_MOTION: {
-
- if (what == "axis_index") {
- r_ret = filters[idx].joy_motion.axis >> 1;
- } else if (what == "mode") {
- r_ret = filters[idx].joy_motion.axis & 1;
- } else if (what == "threshold") {
- r_ret = filters[idx].joy_motion.axis_value;
- } else {
- return false;
- }
- return true;
-
- } break;
- case Ref<InputEvent>::JOYPAD_BUTTON: {
-
- if (what == "button_index") {
- r_ret = filters[idx].joy_button->get_button_index();
- } else if (what == "pressed") {
- r_ret = filters[idx].joy_button->is_pressed();
- } else {
- return false;
- }
- return true;
-
- } break;
- case Ref<InputEvent>::SCREEN_TOUCH: {
-
- if (what == "finger_index") {
- r_ret = filters[idx].screen_touch.index;
- } else if (what == "pressed") {
- r_ret = filters[idx].screen_touch->is_pressed();
- } else {
- return false;
- }
- return true;
- } break;
- case Ref<InputEvent>::SCREEN_DRAG: {
- if (what == "finger_index") {
- r_ret = filters[idx].screen_drag.index;
- } else {
- return false;
- }
- return true;
- } break;
- case Ref<InputEvent>::ACTION: {
-
- if (what == "action_name") {
-
- List<PropertyInfo> pinfo;
- ProjectSettings::get_singleton()->get_property_list(&pinfo);
- int index = 1;
-
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
- const PropertyInfo &pi = E->get();
-
- if (!pi.name.begins_with("input/"))
- continue;
-
- if (filters[idx].action.action == index) {
- r_ret = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
- return true;
- }
- index++;
- }
-
- r_ret = "None"; //no index
- return false;
-
- } else if (what == "pressed") {
-
- r_ret = filters[idx].action->is_pressed();
- return true;
- }
-
- } break;
- }
- }
- return false;
-}
-
-static const char *event_type_names[Ref<InputEvent>::TYPE_MAX] = {
- "None",
- "Key",
- "MouseMotion",
- "MouseButton",
- "JoypadMotion",
- "JoypadButton",
- "ScreenTouch",
- "ScreenDrag",
- "Action"
-};
-
-void VisualScriptInputFilter::_get_property_list(List<PropertyInfo> *p_list) const {
-
- p_list->push_back(PropertyInfo(Variant::INT, "filter_count", PROPERTY_HINT_RANGE, "0,64"));
-
- String et;
- for (int i = 0; i < Ref<InputEvent>::TYPE_MAX; i++) {
- if (i > 0)
- et += ",";
-
- et += event_type_names[i];
- }
-
- String kc;
- String actions;
-
- for (int i = 0; i < filters.size(); i++) {
-
- String base = "filter_" + itos(i) + "/";
- p_list->push_back(PropertyInfo(Variant::INT, base + "type", PROPERTY_HINT_ENUM, et));
- p_list->push_back(PropertyInfo(Variant::INT, base + "device"));
- switch (filters[i].type) {
-
- case Ref<InputEvent>::NONE: {
-
- } break;
- case Ref<InputEvent>::KEY: {
- if (kc == String()) {
- int kcc = keycode_get_count();
- kc = "None";
- for (int i = 0; i < kcc; i++) {
- kc += ",";
- kc += String(keycode_get_name_by_index(i));
- }
- }
- p_list->push_back(PropertyInfo(Variant::STRING, base + "scancode", PROPERTY_HINT_ENUM, kc));
- p_list->push_back(PropertyInfo(Variant::STRING, base + "unicode"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "echo"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta"));
-
- } break;
- case Ref<InputEvent>::MOUSE_MOTION: {
- p_list->push_back(PropertyInfo(Variant::INT, base + "button_mask", PROPERTY_HINT_FLAGS, "Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta"));
-
- } break;
- case Ref<InputEvent>::MOUSE_BUTTON: {
- p_list->push_back(PropertyInfo(Variant::INT, base + "button_index", PROPERTY_HINT_ENUM, "Any,Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "doubleclicked"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta"));
-
- } break;
- case Ref<InputEvent>::JOYPAD_MOTION: {
-
- p_list->push_back(PropertyInfo(Variant::INT, base + "axis_index"));
- p_list->push_back(PropertyInfo(Variant::INT, base + "mode", PROPERTY_HINT_ENUM, "Min,Max"));
- p_list->push_back(PropertyInfo(Variant::REAL, base + "threshold", PROPERTY_HINT_RANGE, "0,1,0.01"));
- } break;
- case Ref<InputEvent>::JOYPAD_BUTTON: {
- p_list->push_back(PropertyInfo(Variant::INT, base + "button_index"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
-
- } break;
- case Ref<InputEvent>::SCREEN_TOUCH: {
- p_list->push_back(PropertyInfo(Variant::INT, base + "finger_index"));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
-
- } break;
- case Ref<InputEvent>::SCREEN_DRAG: {
- p_list->push_back(PropertyInfo(Variant::INT, base + "finger_index"));
- } break;
- case Ref<InputEvent>::ACTION: {
-
- if (actions == String()) {
-
- actions = "None";
-
- List<PropertyInfo> pinfo;
- ProjectSettings::get_singleton()->get_property_list(&pinfo);
- Vector<String> al;
-
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
- const PropertyInfo &pi = E->get();
-
- if (!pi.name.begins_with("input/"))
- continue;
-
- String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
-
- al.push_back(name);
- }
-
- for (int i = 0; i < al.size(); i++) {
- actions += ",";
- actions += al[i];
- }
- }
-
- p_list->push_back(PropertyInfo(Variant::STRING, base + "action_name", PROPERTY_HINT_ENUM, actions));
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
-
- } break;
- }
- }
-}
-
-class VisualScriptNodeInstanceInputFilter : public VisualScriptNodeInstance {
-public:
- VisualScriptInstance *instance;
- Vector<Ref<InputEvent>> filters;
-
- //virtual int get_working_memory_size() const { return 0; }
- //virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
- //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
-
- virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
-
- if (p_inputs[0]->get_type() != Variant::INPUT_EVENT) {
- r_error_str = "Input value not of type event";
- r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
- return 0;
- }
-
- Ref<InputEvent> event = *p_inputs[0];
-
- for (int i = 0; i < filters.size(); i++) {
-
- const Ref<InputEvent> &ie = filters[i];
- if (ie.type != event.type)
- continue;
-
- bool match = false;
-
- switch (ie.type) {
-
- case Ref<InputEvent>::NONE: {
-
- match = true;
- } break;
- case Ref<InputEvent>::KEY: {
-
- InputEventKey k = ie.key;
- InputEventKey k2 = event.key;
-
- if (k->get_scancode() == 0 && k.unicode == 0 && k2->get_scancode() == 0 && k2.unicode == 0) {
- match = true;
-
- } else {
-
- if ((k->get_scancode() != 0 && k->get_scancode() == k2->get_scancode()) || (k.unicode != 0 && k.unicode == k2.unicode)) {
- //key valid
-
- if (
- k->is_pressed() == k2->is_pressed() &&
- k.echo == k2.echo &&
- k.mod == k2.mod) {
- match = true;
- }
- }
- }
-
- } break;
- case Ref<InputEvent>::MOUSE_MOTION: {
- InputEventMouseMotion mm = ie.mouse_motion;
- InputEventMouseMotion mm2 = event.mouse_motion;
-
- if (mm->get_button_mask() == mm2->get_button_mask() &&
- mm.mod == mm2.mod) {
- match = true;
- }
-
- } break;
- case Ref<InputEvent>::MOUSE_BUTTON: {
-
- InputEventMouseButton mb = ie.mouse_button;
- InputEventMouseButton mb2 = event.mouse_button;
-
- if (mb->get_button_index() == mb2->get_button_index() &&
- mb->is_pressed() == mb2->is_pressed() &&
- mb.doubleclick == mb2.doubleclick &&
- mb.mod == mb2.mod) {
- match = true;
- }
-
- } break;
- case Ref<InputEvent>::JOYPAD_MOTION: {
-
- InputEventJoypadMotion jm = ie.joy_motion;
- InputEventJoypadMotion jm2 = event.joy_motion;
-
- int axis = jm.axis >> 1;
-
- if (axis == jm2.axis) {
-
- if (jm.axis & 1) {
- //greater
- if (jm2.axis_value > jm.axis_value) {
- match = true;
- }
- } else {
- //less
- if (jm2.axis_value < -jm.axis_value) {
- match = true;
- }
- }
- }
-
- } break;
- case Ref<InputEvent>::JOYPAD_BUTTON: {
- InputEventJoypadButton jb = ie.joy_button;
- InputEventJoypadButton jb2 = event.joy_button;
-
- if (jb->get_button_index() == jb2->get_button_index() &&
- jb->is_pressed() == jb2->is_pressed()) {
- match = true;
- }
- } break;
- case Ref<InputEvent>::SCREEN_TOUCH: {
- InputEventScreenTouch st = ie.screen_touch;
- InputEventScreenTouch st2 = event.screen_touch;
-
- if (st.index == st2.index &&
- st->is_pressed() == st2->is_pressed()) {
- match = true;
- }
-
- } break;
- case Ref<InputEvent>::SCREEN_DRAG: {
- InputEventScreenDrag sd = ie.screen_drag;
- InputEventScreenDrag sd2 = event.screen_drag;
-
- if (sd.index == sd2.index) {
- match = true;
- }
- } break;
- case Ref<InputEvent>::ACTION: {
-
- InputEventAction ia = ie.action;
- InputEventAction ia2 = event.action;
-
- if (ia.action == ia2.action &&
- ia->is_pressed() == ia2->is_pressed()) {
- match = true;
- }
- } break;
- }
-
- *p_outputs[0] = event;
-
- if (match)
- return i; //go through match output
- }
-
- return STEP_NO_ADVANCE_BIT; //none found, don't advance
- }
-};
-
-VisualScriptNodeInstance *VisualScriptInputFilter::instance(VisualScriptInstance *p_instance) {
-
- VisualScriptNodeInstanceInputFilter *instance = memnew(VisualScriptNodeInstanceInputFilter);
- instance->instance = p_instance;
- instance->filters = filters;
- return instance;
-}
-
-VisualScriptInputFilter::VisualScriptInputFilter() {
-}
-#endif
-//////////////////////////////////////////
////////////////TYPE CAST///////////
//////////////////////////////////////////
diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h
index 380eb76c45..40809d488a 100644
--- a/modules/visual_script/visual_script_flow_control.h
+++ b/modules/visual_script/visual_script_flow_control.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUAL_SCRIPT_FLOW_CONTROL_H
#define VISUAL_SCRIPT_FLOW_CONTROL_H
@@ -228,40 +229,6 @@ public:
VisualScriptSwitch();
};
-#if 0
-class VisualScriptInputFilter : public VisualScriptNode {
-
- GDCLASS(VisualScriptInputFilter, VisualScriptNode)
-
- Vector<Ref<InputEvent>> filters;
-
-protected:
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
-
-public:
- virtual int get_output_sequence_port_count() const;
- virtual bool has_input_sequence_port() const;
-
- virtual String get_output_sequence_port_text(int p_port) const;
-
- virtual int get_input_value_port_count() const;
- virtual int get_output_value_port_count() const;
-
- virtual PropertyInfo get_input_value_port_info(int p_idx) const;
- virtual PropertyInfo get_output_value_port_info(int p_idx) const;
-
- virtual String get_caption() const;
- virtual String get_text() const;
- virtual String get_category() const { return "flow_control"; }
-
- virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
-
- VisualScriptInputFilter();
-};
-#endif
-
class VisualScriptTypeCast : public VisualScriptNode {
GDCLASS(VisualScriptTypeCast, VisualScriptNode)
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 8d73de9889..187c9b0b9e 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,11 +27,12 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_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 +345,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 +381,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();
@@ -424,7 +425,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
#ifdef DEBUG_METHODS_ENABLED
- method_cache.return_val = mb->get_argument_info(-1);
+ method_cache.return_val = mb->get_return_info();
#endif
if (mb->is_vararg()) {
@@ -545,7 +546,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (property.name == "base_type") {
if (call_mode != CALL_MODE_INSTANCE) {
- property.usage = PROPERTY_USAGE_NOEDITOR;
+ property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
}
}
@@ -565,11 +566,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 +604,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());
@@ -738,7 +739,7 @@ void VisualScriptFunctionCall::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "singleton"), "set_singleton", "get_singleton");
ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path");
- ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "argument_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_argument_cache", "_get_argument_cache");
+ ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "argument_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_argument_cache", "_get_argument_cache");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "function"), "set_function", "get_function"); //when set, if loaded properly, will override argument count.
ADD_PROPERTY(PropertyInfo(Variant::INT, "use_default_args"), "set_use_default_args", "get_use_default_args");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "validate"), "set_validate", "get_validate");
@@ -858,6 +859,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 +880,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) + "'";
@@ -1347,7 +1350,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
if (property.name == "base_type") {
if (call_mode != CALL_MODE_INSTANCE) {
- property.usage = PROPERTY_USAGE_NOEDITOR;
+ property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
}
}
@@ -1490,7 +1493,7 @@ void VisualScriptPropertySet::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "set_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type"), "set_call_mode", "get_call_mode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_type_cache", "_get_type_cache");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_type_cache", "_get_type_cache");
ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "property"), "set_property", "get_property");
@@ -2075,7 +2078,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
if (property.name == "base_type") {
if (call_mode != CALL_MODE_INSTANCE) {
- property.usage = PROPERTY_USAGE_NOEDITOR;
+ property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
}
}
@@ -2214,7 +2217,7 @@ void VisualScriptPropertyGet::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "set_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type"), "set_call_mode", "get_call_mode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type", PROPERTY_HINT_TYPE_STRING, "Object"), "set_base_type", "get_base_type");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_type_cache", "_get_type_cache");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_type_cache", "_get_type_cache");
ADD_PROPERTY(PropertyInfo(Variant::INT, "basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "property"), "set_property", "get_property");
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index a9a0bd083f..0b30eae65a 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUAL_SCRIPT_FUNC_NODES_H
#define VISUAL_SCRIPT_FUNC_NODES_H
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index d3cd839cf3..c5654a5a20 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,8 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_nodes.h"
+#include "engine.h"
#include "global_constants.h"
#include "os/input.h"
#include "os/os.h"
@@ -389,7 +391,7 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const {
{ Variant::NIL, Variant::NIL }, //OP_GREATER_EQUAL,
//mathematic
{ Variant::NIL, Variant::NIL }, //OP_ADD,
- { Variant::NIL, Variant::NIL }, //OP_SUBSTRACT,
+ { Variant::NIL, Variant::NIL }, //OP_SUBTRACT,
{ Variant::NIL, Variant::NIL }, //OP_MULTIPLY,
{ Variant::NIL, Variant::NIL }, //OP_DIVIDE,
{ Variant::NIL, Variant::NIL }, //OP_NEGATE,
@@ -423,7 +425,7 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const {
}
PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
static const Variant::Type port_types[Variant::OP_MAX] = {
- //comparation
+ //comparison
Variant::BOOL, //OP_EQUAL,
Variant::BOOL, //OP_NOT_EQUAL,
Variant::BOOL, //OP_LESS,
@@ -432,7 +434,7 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
Variant::BOOL, //OP_GREATER_EQUAL,
//mathematic
Variant::NIL, //OP_ADD,
- Variant::NIL, //OP_SUBSTRACT,
+ Variant::NIL, //OP_SUBTRACT,
Variant::NIL, //OP_MULTIPLY,
Variant::NIL, //OP_DIVIDE,
Variant::NIL, //OP_NEGATE,
@@ -464,7 +466,7 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
}
static const char *op_names[] = {
- //comparation
+ //comparison
"Equal", //OP_EQUAL,
"NotEqual", //OP_NOT_EQUAL,
"Less", //OP_LESS,
@@ -473,7 +475,7 @@ static const char *op_names[] = {
"GreaterEq", //OP_GREATER_EQUAL,
//mathematic
"Add", //OP_ADD,
- "Subtract", //OP_SUBSTRACT,
+ "Subtract", //OP_SUBTRACT,
"Multiply", //OP_MULTIPLY,
"Divide", //OP_DIVIDE,
"Negate", //OP_NEGATE,
@@ -504,7 +506,7 @@ String VisualScriptOperator::get_caption() const {
String VisualScriptOperator::get_text() const {
static const wchar_t *op_names[] = {
- //comparation
+ //comparison
L"A = B", //OP_EQUAL,
L"A \u2260 B", //OP_NOT_EQUAL,
L"A < B", //OP_LESS,
@@ -513,7 +515,7 @@ String VisualScriptOperator::get_text() const {
L"A \u2265 B", //OP_GREATER_EQUAL,
//mathematic
L"A + B", //OP_ADD,
- L"A - B", //OP_SUBSTRACT,
+ L"A - B", //OP_SUBTRACT,
L"A x B", //OP_MULTIPLY,
L"A \u00F7 B", //OP_DIVIDE,
L"\u00AC A", //OP_NEGATE,
@@ -1063,9 +1065,9 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
return;
type = p_type;
- ports_changed_notify();
Variant::CallError ce;
value = Variant::construct(type, NULL, 0, ce);
+ ports_changed_notify();
_change_notify();
}
@@ -1110,7 +1112,7 @@ void VisualScriptConstant::_bind_methods() {
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt), "set_constant_type", "get_constant_type");
- ADD_PROPERTY(PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), "set_constant_value", "get_constant_value");
+ ADD_PROPERTY(PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT | PROPERTY_USAGE_DEFAULT), "set_constant_value", "get_constant_value");
}
class VisualScriptNodeInstanceConstant : public VisualScriptNodeInstance {
@@ -1776,8 +1778,8 @@ VisualScriptBasicTypeConstant::VisualScriptBasicTypeConstant() {
const char *VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX] = {
"One",
"PI",
- "PIx2",
"PI/2",
+ "TAU",
"E",
"Sqrt2",
"INF",
@@ -1787,8 +1789,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 +1888,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 +1978,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 +2002,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
@@ -3105,8 +3107,8 @@ void VisualScriptConstructor::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_constructor", "constructor"), &VisualScriptConstructor::set_constructor);
ClassDB::bind_method(D_METHOD("get_constructor"), &VisualScriptConstructor::get_constructor);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_constructor_type", "get_constructor_type");
- ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "constructor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_constructor", "get_constructor");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_constructor_type", "get_constructor_type");
+ ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "constructor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_constructor", "get_constructor");
}
VisualScriptConstructor::VisualScriptConstructor() {
@@ -3720,7 +3722,7 @@ void VisualScriptDeconstruct::_bind_methods() {
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt), "set_deconstruct_type", "get_deconstruct_type");
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "elem_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_elem_cache", "_get_elem_cache");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "elem_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_elem_cache", "_get_elem_cache");
}
VisualScriptDeconstruct::VisualScriptDeconstruct() {
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 421409b265..a581e81c8c 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUAL_SCRIPT_NODES_H
#define VISUAL_SCRIPT_NODES_H
@@ -474,8 +475,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,
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index 3c9076246d..a96e8408c0 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "visual_script_yield_nodes.h"
#include "os/os.h"
diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h
index 4a595a875a..4009240581 100644
--- a/modules/visual_script/visual_script_yield_nodes.h
+++ b/modules/visual_script/visual_script_yield_nodes.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#ifndef VISUAL_SCRIPT_YIELD_NODES_H
#define VISUAL_SCRIPT_YIELD_NODES_H