summaryrefslogtreecommitdiff
path: root/modules/visual_script
diff options
context:
space:
mode:
Diffstat (limited to 'modules/visual_script')
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml54
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCustomNode.xml54
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEditor.xml37
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSubCall.xml7
-rw-r--r--modules/visual_script/register_types.cpp12
-rw-r--r--modules/visual_script/visual_script.cpp32
-rw-r--r--modules/visual_script/visual_script.h6
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp40
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h2
-rw-r--r--modules/visual_script/visual_script_editor.cpp33
-rw-r--r--modules/visual_script/visual_script_editor.h21
-rw-r--r--modules/visual_script/visual_script_nodes.cpp176
-rw-r--r--modules/visual_script/visual_script_nodes.h32
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp2
14 files changed, 225 insertions, 283 deletions
diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
index 195d766c1d..55d0b392fa 100644
--- a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
+++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
@@ -138,81 +138,75 @@
<constant name="MATH_DB2LINEAR" value="40" enum="BuiltinFunc">
Convert the input from decibel volume to linear volume.
</constant>
- <constant name="MATH_POLAR2CARTESIAN" value="41" 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 name="MATH_WRAP" value="41" enum="BuiltinFunc">
</constant>
- <constant name="MATH_CARTESIAN2POLAR" value="42" 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 name="MATH_WRAPF" value="42" enum="BuiltinFunc">
</constant>
- <constant name="MATH_WRAP" value="43" enum="BuiltinFunc">
- </constant>
- <constant name="MATH_WRAPF" value="44" enum="BuiltinFunc">
- </constant>
- <constant name="LOGIC_MAX" value="45" enum="BuiltinFunc">
+ <constant name="LOGIC_MAX" value="43" enum="BuiltinFunc">
Return the greater of the two numbers, also known as their maximum.
</constant>
- <constant name="LOGIC_MIN" value="46" enum="BuiltinFunc">
+ <constant name="LOGIC_MIN" value="44" enum="BuiltinFunc">
Return the lesser of the two numbers, also known as their minimum.
</constant>
- <constant name="LOGIC_CLAMP" value="47" enum="BuiltinFunc">
+ <constant name="LOGIC_CLAMP" value="45" enum="BuiltinFunc">
Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to [code]min(max(input, range_low), range_high)[/code].
</constant>
- <constant name="LOGIC_NEAREST_PO2" value="48" enum="BuiltinFunc">
+ <constant name="LOGIC_NEAREST_PO2" value="46" enum="BuiltinFunc">
Return the nearest power of 2 to the input.
</constant>
- <constant name="OBJ_WEAKREF" value="49" enum="BuiltinFunc">
+ <constant name="OBJ_WEAKREF" value="47" enum="BuiltinFunc">
Create a [WeakRef] from the input.
</constant>
- <constant name="TYPE_CONVERT" value="50" enum="BuiltinFunc">
+ <constant name="TYPE_CONVERT" value="48" enum="BuiltinFunc">
Convert between types.
</constant>
- <constant name="TYPE_OF" value="51" enum="BuiltinFunc">
+ <constant name="TYPE_OF" value="49" 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">
+ <constant name="TYPE_EXISTS" value="50" enum="BuiltinFunc">
Checks if a type is registered in the [ClassDB].
</constant>
- <constant name="TEXT_CHAR" value="53" enum="BuiltinFunc">
+ <constant name="TEXT_CHAR" value="51" enum="BuiltinFunc">
Return a character with the given ascii value.
</constant>
- <constant name="TEXT_STR" value="54" enum="BuiltinFunc">
+ <constant name="TEXT_STR" value="52" enum="BuiltinFunc">
Convert the input to a string.
</constant>
- <constant name="TEXT_PRINT" value="55" enum="BuiltinFunc">
+ <constant name="TEXT_PRINT" value="53" enum="BuiltinFunc">
Print the given string to the output window.
</constant>
- <constant name="TEXT_PRINTERR" value="56" enum="BuiltinFunc">
+ <constant name="TEXT_PRINTERR" value="54" enum="BuiltinFunc">
Print the given string to the standard error output.
</constant>
- <constant name="TEXT_PRINTRAW" value="57" enum="BuiltinFunc">
+ <constant name="TEXT_PRINTRAW" value="55" enum="BuiltinFunc">
Print the given string to the standard output, without adding a newline.
</constant>
- <constant name="VAR_TO_STR" value="58" enum="BuiltinFunc">
+ <constant name="VAR_TO_STR" value="56" enum="BuiltinFunc">
Serialize a [Variant] to a string.
</constant>
- <constant name="STR_TO_VAR" value="59" enum="BuiltinFunc">
+ <constant name="STR_TO_VAR" value="57" enum="BuiltinFunc">
Deserialize a [Variant] from a string serialized using [constant VAR_TO_STR].
</constant>
- <constant name="VAR_TO_BYTES" value="60" enum="BuiltinFunc">
+ <constant name="VAR_TO_BYTES" value="58" enum="BuiltinFunc">
Serialize a [Variant] to a [PackedByteArray].
</constant>
- <constant name="BYTES_TO_VAR" value="61" enum="BuiltinFunc">
+ <constant name="BYTES_TO_VAR" value="59" enum="BuiltinFunc">
Deserialize a [Variant] from a [PackedByteArray] serialized using [constant VAR_TO_BYTES].
</constant>
- <constant name="MATH_SMOOTHSTEP" value="62" enum="BuiltinFunc">
+ <constant name="MATH_SMOOTHSTEP" value="60" enum="BuiltinFunc">
Return a number smoothly interpolated between the first two inputs, based on the third input. Similar to [constant MATH_LERP], but interpolates faster at the beginning and slower at the end. Using Hermite interpolation formula:
[codeblock]
var t = clamp((weight - from) / (to - from), 0.0, 1.0)
return t * t * (3.0 - 2.0 * t)
[/codeblock]
</constant>
- <constant name="MATH_POSMOD" value="63" enum="BuiltinFunc">
+ <constant name="MATH_POSMOD" value="61" enum="BuiltinFunc">
</constant>
- <constant name="MATH_LERP_ANGLE" value="64" enum="BuiltinFunc">
+ <constant name="MATH_LERP_ANGLE" value="62" enum="BuiltinFunc">
</constant>
- <constant name="TEXT_ORD" value="65" enum="BuiltinFunc">
+ <constant name="TEXT_ORD" value="63" enum="BuiltinFunc">
</constant>
- <constant name="FUNC_MAX" value="66" enum="BuiltinFunc">
+ <constant name="FUNC_MAX" value="64" enum="BuiltinFunc">
Represents the size of the [enum BuiltinFunc] enum.
</constant>
</constants>
diff --git a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
index 8aa34f8cae..b574576856 100644
--- a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
@@ -9,118 +9,118 @@
<tutorials>
</tutorials>
<methods>
- <method name="_get_caption" qualifiers="virtual">
+ <method name="_get_caption" qualifiers="virtual const">
<return type="String" />
<description>
Return the node's title.
</description>
</method>
- <method name="_get_category" qualifiers="virtual">
+ <method name="_get_category" qualifiers="virtual const">
<return type="String" />
<description>
Return the node's category.
</description>
</method>
- <method name="_get_input_value_port_count" qualifiers="virtual">
+ <method name="_get_input_value_port_count" qualifiers="virtual const">
<return type="int" />
<description>
Return the count of input value ports.
</description>
</method>
- <method name="_get_input_value_port_hint" qualifiers="virtual">
+ <method name="_get_input_value_port_hint" qualifiers="virtual const">
<return type="int" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="input_idx" type="int" />
<description>
Return the specified input port's hint. See the [enum @GlobalScope.PropertyHint] hints.
</description>
</method>
- <method name="_get_input_value_port_hint_string" qualifiers="virtual">
+ <method name="_get_input_value_port_hint_string" qualifiers="virtual const">
<return type="String" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="input_idx" type="int" />
<description>
Return the specified input port's hint string.
</description>
</method>
- <method name="_get_input_value_port_name" qualifiers="virtual">
+ <method name="_get_input_value_port_name" qualifiers="virtual const">
<return type="String" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="input_idx" type="int" />
<description>
Return the specified input port's name.
</description>
</method>
- <method name="_get_input_value_port_type" qualifiers="virtual">
+ <method name="_get_input_value_port_type" qualifiers="virtual const">
<return type="int" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="input_idx" type="int" />
<description>
Return the specified input port's type. See the [enum Variant.Type] values.
</description>
</method>
- <method name="_get_output_sequence_port_count" qualifiers="virtual">
+ <method name="_get_output_sequence_port_count" qualifiers="virtual const">
<return type="int" />
<description>
Return the amount of output [b]sequence[/b] ports.
</description>
</method>
- <method name="_get_output_sequence_port_text" qualifiers="virtual">
+ <method name="_get_output_sequence_port_text" qualifiers="virtual const">
<return type="String" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="seq_idx" type="int" />
<description>
Return the specified [b]sequence[/b] output's name.
</description>
</method>
- <method name="_get_output_value_port_count" qualifiers="virtual">
+ <method name="_get_output_value_port_count" qualifiers="virtual const">
<return type="int" />
<description>
Return the amount of output value ports.
</description>
</method>
- <method name="_get_output_value_port_hint" qualifiers="virtual">
+ <method name="_get_output_value_port_hint" qualifiers="virtual const">
<return type="int" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="output_idx" type="int" />
<description>
Return the specified output port's hint. See the [enum @GlobalScope.PropertyHint] hints.
</description>
</method>
- <method name="_get_output_value_port_hint_string" qualifiers="virtual">
+ <method name="_get_output_value_port_hint_string" qualifiers="virtual const">
<return type="String" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="output_idx" type="int" />
<description>
Return the specified output port's hint string.
</description>
</method>
- <method name="_get_output_value_port_name" qualifiers="virtual">
+ <method name="_get_output_value_port_name" qualifiers="virtual const">
<return type="String" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="output_idx" type="int" />
<description>
Return the specified output port's name.
</description>
</method>
- <method name="_get_output_value_port_type" qualifiers="virtual">
+ <method name="_get_output_value_port_type" qualifiers="virtual const">
<return type="int" />
- <argument index="0" name="idx" type="int" />
+ <argument index="0" name="output_idx" type="int" />
<description>
Return the specified output port's type. See the [enum Variant.Type] values.
</description>
</method>
- <method name="_get_text" qualifiers="virtual">
+ <method name="_get_text" qualifiers="virtual const">
<return type="String" />
<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">
+ <method name="_get_working_memory_size" qualifiers="virtual const">
<return type="int" />
<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">
+ <method name="_has_input_sequence_port" qualifiers="virtual const">
<return type="bool" />
<description>
Return whether the custom node has an input [b]sequence[/b] port.
</description>
</method>
- <method name="_step" qualifiers="virtual">
+ <method name="_step" qualifiers="virtual const">
<return type="Variant" />
<argument index="0" name="inputs" type="Array" />
<argument index="1" name="outputs" type="Array" />
diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml
deleted file mode 100644
index 9ea889c77b..0000000000
--- a/modules/visual_script/doc_classes/VisualScriptEditor.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEditor" inherits="Object" version="4.0">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="add_custom_node">
- <return type="void" />
- <argument index="0" name="name" type="String" />
- <argument index="1" name="category" type="String" />
- <argument index="2" name="script" type="Script" />
- <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" />
- <argument index="0" name="name" type="String" />
- <argument index="1" name="category" type="String" />
- <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/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
index 374e7d0f35..f54887b09c 100644
--- a/modules/visual_script/doc_classes/VisualScriptSubCall.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
@@ -9,13 +9,6 @@
<tutorials>
</tutorials>
<methods>
- <method name="_subcall" qualifiers="virtual">
- <return type="Variant" />
- <argument index="0" name="arguments" type="Variant" />
- <description>
- Called by this node.
- </description>
- </method>
</methods>
<constants>
</constants>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index f20ef046a3..7fb9707fce 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -43,7 +43,7 @@
VisualScriptLanguage *visual_script_language = nullptr;
#ifdef TOOLS_ENABLED
-static _VisualScriptEditor *vs_editor_singleton = nullptr;
+static VisualScriptCustomNodes *vs_custom_nodes_singleton = nullptr;
#endif
void register_visual_script_types() {
@@ -114,10 +114,10 @@ void register_visual_script_types() {
#ifdef TOOLS_ENABLED
ClassDB::set_current_api(ClassDB::API_EDITOR);
- GDREGISTER_CLASS(_VisualScriptEditor);
+ GDREGISTER_CLASS(VisualScriptCustomNodes);
ClassDB::set_current_api(ClassDB::API_CORE);
- vs_editor_singleton = memnew(_VisualScriptEditor);
- Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton()));
+ vs_custom_nodes_singleton = memnew(VisualScriptCustomNodes);
+ Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", VisualScriptCustomNodes::get_singleton()));
VisualScriptEditor::register_editor();
#endif
@@ -130,8 +130,8 @@ void unregister_visual_script_types() {
#ifdef TOOLS_ENABLED
VisualScriptEditor::free_clipboard();
- if (vs_editor_singleton) {
- memdelete(vs_editor_singleton);
+ if (vs_custom_nodes_singleton) {
+ memdelete(vs_custom_nodes_singleton);
}
#endif
if (visual_script_language) {
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 86793af77f..4d5f3420b8 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -955,7 +955,7 @@ bool VisualScript::are_subnodes_edited() const {
}
#endif
-const Vector<MultiplayerAPI::RPCConfig> VisualScript::get_rpc_methods() const {
+const Vector<Multiplayer::RPCConfig> VisualScript::get_rpc_methods() const {
return rpc_functions;
}
@@ -1022,11 +1022,11 @@ void VisualScript::_set_data(const Dictionary &p_data) {
if (functions[E].func_id >= 0 && nodes.has(functions[E].func_id)) {
Ref<VisualScriptFunction> vsf = nodes[functions[E].func_id].node;
if (vsf.is_valid()) {
- if (vsf->get_rpc_mode() != MultiplayerAPI::RPC_MODE_DISABLED) {
- MultiplayerAPI::RPCConfig nd;
+ if (vsf->get_rpc_mode() != Multiplayer::RPC_MODE_DISABLED) {
+ Multiplayer::RPCConfig nd;
nd.name = E;
nd.rpc_mode = vsf->get_rpc_mode();
- nd.transfer_mode = MultiplayerPeer::TRANSFER_MODE_RELIABLE; // TODO
+ nd.transfer_mode = Multiplayer::TRANSFER_MODE_RELIABLE; // TODO
if (rpc_functions.find(nd) == -1) {
rpc_functions.push_back(nd);
}
@@ -1036,7 +1036,7 @@ void VisualScript::_set_data(const Dictionary &p_data) {
}
// Sort so we are 100% that they are always the same.
- rpc_functions.sort_custom<MultiplayerAPI::SortRPCConfig>();
+ rpc_functions.sort_custom<Multiplayer::SortRPCConfig>();
}
Dictionary VisualScript::_get_data() const {
@@ -1833,7 +1833,7 @@ Ref<Script> VisualScriptInstance::get_script() const {
return script;
}
-const Vector<MultiplayerAPI::RPCConfig> VisualScriptInstance::get_rpc_methods() const {
+const Vector<Multiplayer::RPCConfig> VisualScriptInstance::get_rpc_methods() const {
return script->get_rpc_methods();
}
@@ -1845,26 +1845,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
max_input_args = 0;
max_output_args = 0;
- if (Object::cast_to<Node>(p_owner)) {
- // Turn on these if they exist and base is a node.
- Node *node = Object::cast_to<Node>(p_owner);
- if (p_script->functions.has("_process")) {
- node->set_process(true);
- }
- if (p_script->functions.has("_physics_process")) {
- node->set_physics_process(true);
- }
- if (p_script->functions.has("_input")) {
- node->set_process_input(true);
- }
- if (p_script->functions.has("_unhandled_input")) {
- node->set_process_unhandled_input(true);
- }
- if (p_script->functions.has("_unhandled_key_input")) {
- node->set_process_unhandled_key_input(true);
- }
- }
-
// Setup variables.
{
List<StringName> keys;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 932ebeb27f..39cef8f68b 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -234,7 +234,7 @@ private:
HashMap<StringName, Function> functions;
HashMap<StringName, Variable> variables;
Map<StringName, Vector<Argument>> custom_signals;
- Vector<MultiplayerAPI::RPCConfig> rpc_functions;
+ Vector<Multiplayer::RPCConfig> rpc_functions;
Map<Object *, VisualScriptInstance *> instances;
@@ -362,7 +362,7 @@ public:
virtual int get_member_line(const StringName &p_member) const override;
- virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const override;
+ virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const override;
#ifdef TOOLS_ENABLED
virtual bool are_subnodes_edited() const;
@@ -443,7 +443,7 @@ public:
virtual ScriptLanguage *get_language();
- virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const;
+ virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const;
VisualScriptInstance();
~VisualScriptInstance();
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index c61c3ae272..2bd7220d15 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -79,8 +79,6 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"rad2deg",
"linear2db",
"db2linear",
- "polar2cartesian",
- "cartesian2polar",
"wrapi",
"wrapf",
"max",
@@ -194,8 +192,6 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case MATH_SNAPPED:
case MATH_RANDF_RANGE:
case MATH_RANDI_RANGE:
- case MATH_POLAR2CARTESIAN:
- case MATH_CARTESIAN2POLAR:
case LOGIC_MAX:
case LOGIC_MIN:
case TYPE_CONVERT:
@@ -381,20 +377,6 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_DB2LINEAR: {
return PropertyInfo(Variant::FLOAT, "db");
} break;
- case MATH_POLAR2CARTESIAN: {
- if (p_idx == 0) {
- return PropertyInfo(Variant::FLOAT, "r");
- } else {
- return PropertyInfo(Variant::FLOAT, "th");
- }
- } break;
- case MATH_CARTESIAN2POLAR: {
- if (p_idx == 0) {
- return PropertyInfo(Variant::FLOAT, "x");
- } else {
- return PropertyInfo(Variant::FLOAT, "y");
- }
- } break;
case MATH_WRAP: {
if (p_idx == 0) {
return PropertyInfo(Variant::INT, "value");
@@ -553,10 +535,6 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
case MATH_DB2LINEAR: {
t = Variant::FLOAT;
} break;
- case MATH_POLAR2CARTESIAN:
- case MATH_CARTESIAN2POLAR: {
- t = Variant::VECTOR2;
- } break;
case MATH_WRAP: {
t = Variant::INT;
} break;
@@ -874,20 +852,6 @@ 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);
@@ -1229,8 +1193,6 @@ 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);
@@ -1320,8 +1282,6 @@ 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 f59a7a0f0c..26abc1e479 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -79,8 +79,6 @@ 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 f3b6d74b7d..eee9e8f32b 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -1816,7 +1816,7 @@ void VisualScriptEditor::_generic_search(String p_base_type, Vector2 pos, bool n
}
}
-void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
+void VisualScriptEditor::input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
// GUI input for VS Editor Plugin
@@ -4246,8 +4246,6 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw);
ClassDB::bind_method("_drop_data_fw", &VisualScriptEditor::drop_data_fw);
- ClassDB::bind_method("_input", &VisualScriptEditor::_input);
-
ClassDB::bind_method("_update_graph_connections", &VisualScriptEditor::_update_graph_connections);
ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members);
@@ -4521,44 +4519,47 @@ void VisualScriptEditor::register_editor() {
EditorNode::add_plugin_init_callback(register_editor_callback);
}
-Ref<VisualScriptNode> _VisualScriptEditor::create_node_custom(const String &p_name) {
+void VisualScriptEditor::validate() {
+}
+
+// VisualScriptCustomNodes
+
+Ref<VisualScriptNode> VisualScriptCustomNodes::create_node_custom(const String &p_name) {
Ref<VisualScriptCustomNode> node;
node.instantiate();
node->set_script(singleton->custom_nodes[p_name]);
return node;
}
-_VisualScriptEditor *_VisualScriptEditor::singleton = nullptr;
-Map<String, REF> _VisualScriptEditor::custom_nodes;
+VisualScriptCustomNodes *VisualScriptCustomNodes::singleton = nullptr;
+Map<String, REF> VisualScriptCustomNodes::custom_nodes;
-_VisualScriptEditor::_VisualScriptEditor() {
+VisualScriptCustomNodes::VisualScriptCustomNodes() {
singleton = this;
}
-_VisualScriptEditor::~_VisualScriptEditor() {
+VisualScriptCustomNodes::~VisualScriptCustomNodes() {
custom_nodes.clear();
}
-void _VisualScriptEditor::add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script) {
+void VisualScriptCustomNodes::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);
- VisualScriptLanguage::singleton->add_register_func(node_name, &_VisualScriptEditor::create_node_custom);
+ VisualScriptLanguage::singleton->add_register_func(node_name, &VisualScriptCustomNodes::create_node_custom);
emit_signal(SNAME("custom_nodes_updated"));
}
-void _VisualScriptEditor::remove_custom_node(const String &p_name, const String &p_category) {
+void VisualScriptCustomNodes::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(SNAME("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);
+void VisualScriptCustomNodes::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("add_custom_node", "name", "category", "script"), &VisualScriptCustomNodes::add_custom_node);
+ ClassDB::bind_method(D_METHOD("remove_custom_node", "name", "category"), &VisualScriptCustomNodes::remove_custom_node);
ADD_SIGNAL(MethodInfo("custom_nodes_updated"));
}
-void VisualScriptEditor::validate() {
-}
#endif
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 962ea380aa..ab32aae7aa 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -43,13 +43,14 @@ class VisualScriptEditorVariableEdit;
#ifdef TOOLS_ENABLED
+// TODO: Maybe this class should be refactored.
+// See https://github.com/godotengine/godot/issues/51913
class VisualScriptEditor : public ScriptEditorBase {
GDCLASS(VisualScriptEditor, ScriptEditorBase);
enum {
TYPE_SEQUENCE = 1000,
INDEX_BASE_SEQUENCE = 1024
-
};
enum {
@@ -71,7 +72,6 @@ class VisualScriptEditor : public ScriptEditorBase {
enum MemberAction {
MEMBER_EDIT,
MEMBER_REMOVE
-
};
enum MemberType {
@@ -236,7 +236,7 @@ class VisualScriptEditor : public ScriptEditorBase {
void _generic_search(String p_base_type = "", Vector2 pos = Vector2(), bool node_centered = false);
- void _input(const Ref<InputEvent> &p_event);
+ virtual void input(const Ref<InputEvent> &p_event) override;
void _graph_gui_input(const Ref<InputEvent> &p_event);
void _members_gui_input(const Ref<InputEvent> &p_event);
void _fn_name_box_input(const Ref<InputEvent> &p_event);
@@ -311,6 +311,8 @@ public:
virtual void tag_saved_version() override;
virtual void reload(bool p_soft) override;
virtual Array get_breakpoints() override;
+ virtual void set_breakpoint(int p_line, bool p_enable) override{};
+ virtual void clear_breakpoints() override{};
virtual void add_callback(const String &p_function, PackedStringArray p_args) override;
virtual void update_settings() override;
virtual bool show_members_overview() override;
@@ -333,27 +335,28 @@ public:
};
// Singleton
-class _VisualScriptEditor : public Object {
- GDCLASS(_VisualScriptEditor, Object);
+class VisualScriptCustomNodes : public Object {
+ GDCLASS(VisualScriptCustomNodes, Object);
friend class VisualScriptLanguage;
protected:
static void _bind_methods();
- static _VisualScriptEditor *singleton;
+ static VisualScriptCustomNodes *singleton;
static Map<String, REF> custom_nodes;
static Ref<VisualScriptNode> create_node_custom(const String &p_name);
public:
- static _VisualScriptEditor *get_singleton() { return singleton; }
+ static VisualScriptCustomNodes *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();
+ VisualScriptCustomNodes();
+ ~VisualScriptCustomNodes();
};
+
#endif
#endif // VISUALSCRIPT_EDITOR_H
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index c517d89aa5..ef77c0cef3 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -90,7 +90,7 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value
}
if (p_name == "rpc/mode") {
- rpc_mode = MultiplayerAPI::RPCMode(int(p_value));
+ rpc_mode = Multiplayer::RPCMode(int(p_value));
return true;
}
@@ -163,7 +163,7 @@ void VisualScriptFunction::_get_property_list(List<PropertyInfo> *p_list) const
p_list->push_back(PropertyInfo(Variant::INT, "stack/size", PROPERTY_HINT_RANGE, "1,100000"));
}
p_list->push_back(PropertyInfo(Variant::BOOL, "stack/stackless"));
- p_list->push_back(PropertyInfo(Variant::INT, "rpc/mode", PROPERTY_HINT_ENUM, "Disabled,Remote,Master,Puppet,Remote Sync,Master Sync,Puppet Sync"));
+ p_list->push_back(PropertyInfo(Variant::INT, "rpc/mode", PROPERTY_HINT_ENUM, "Disabled,Any,Authority"));
}
int VisualScriptFunction::get_output_sequence_port_count() const {
@@ -261,11 +261,11 @@ int VisualScriptFunction::get_argument_count() const {
return arguments.size();
}
-void VisualScriptFunction::set_rpc_mode(MultiplayerAPI::RPCMode p_mode) {
+void VisualScriptFunction::set_rpc_mode(Multiplayer::RPCMode p_mode) {
rpc_mode = p_mode;
}
-MultiplayerAPI::RPCMode VisualScriptFunction::get_rpc_mode() const {
+Multiplayer::RPCMode VisualScriptFunction::get_rpc_mode() const {
return rpc_mode;
}
@@ -311,14 +311,14 @@ void VisualScriptFunction::reset_state() {
stack_size = 256;
stack_less = false;
sequenced = true;
- rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
+ rpc_mode = Multiplayer::RPC_MODE_DISABLED;
}
VisualScriptFunction::VisualScriptFunction() {
stack_size = 256;
stack_less = false;
sequenced = true;
- rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
+ rpc_mode = Multiplayer::RPC_MODE_DISABLED;
}
void VisualScriptFunction::set_stack_less(bool p_enable) {
@@ -2825,36 +2825,41 @@ VisualScriptSelf::VisualScriptSelf() {
//////////////////////////////////////////
int VisualScriptCustomNode::get_output_sequence_port_count() const {
- if (get_script_instance() && get_script_instance()->has_method("_get_output_sequence_port_count")) {
- return get_script_instance()->call("_get_output_sequence_port_count");
+ int ret;
+ if (GDVIRTUAL_CALL(_get_output_sequence_port_count, ret)) {
+ return ret;
}
return 0;
}
bool VisualScriptCustomNode::has_input_sequence_port() const {
- if (get_script_instance() && get_script_instance()->has_method("_has_input_sequence_port")) {
- return get_script_instance()->call("_has_input_sequence_port");
+ bool ret;
+ if (GDVIRTUAL_CALL(_has_input_sequence_port, ret)) {
+ return ret;
}
return false;
}
int VisualScriptCustomNode::get_input_value_port_count() const {
- if (get_script_instance() && get_script_instance()->has_method("_get_input_value_port_count")) {
- return get_script_instance()->call("_get_input_value_port_count");
+ int ret;
+ if (GDVIRTUAL_CALL(_get_input_value_port_count, ret)) {
+ return ret;
}
return 0;
}
int VisualScriptCustomNode::get_output_value_port_count() const {
- if (get_script_instance() && get_script_instance()->has_method("_get_output_value_port_count")) {
- return get_script_instance()->call("_get_output_value_port_count");
+ int ret;
+ if (GDVIRTUAL_CALL(_get_output_value_port_count, ret)) {
+ return ret;
}
return 0;
}
String VisualScriptCustomNode::get_output_sequence_port_text(int p_port) const {
- if (get_script_instance() && get_script_instance()->has_method("_get_output_sequence_port_text")) {
- return get_script_instance()->call("_get_output_sequence_port_text", p_port);
+ String ret;
+ if (GDVIRTUAL_CALL(_get_output_sequence_port_text, p_port, ret)) {
+ return ret;
}
return String();
@@ -2862,34 +2867,61 @@ String VisualScriptCustomNode::get_output_sequence_port_text(int p_port) const {
PropertyInfo VisualScriptCustomNode::get_input_value_port_info(int p_idx) const {
PropertyInfo info;
- if (get_script_instance() && get_script_instance()->has_method("_get_input_value_port_type")) {
- info.type = Variant::Type(int(get_script_instance()->call("_get_input_value_port_type", p_idx)));
+ {
+ int type;
+ if (GDVIRTUAL_CALL(_get_input_value_port_type, p_idx, type)) {
+ info.type = Variant::Type(type);
+ }
}
- if (get_script_instance() && get_script_instance()->has_method("_get_input_value_port_name")) {
- info.name = get_script_instance()->call("_get_input_value_port_name", p_idx);
+ {
+ String name;
+ if (GDVIRTUAL_CALL(_get_input_value_port_name, p_idx, name)) {
+ info.name = name;
+ }
}
- if (get_script_instance() && get_script_instance()->has_method("_get_input_value_port_hint")) {
- info.hint = PropertyHint(int(get_script_instance()->call("_get_input_value_port_hint", p_idx)));
+ {
+ int hint;
+ if (GDVIRTUAL_CALL(_get_input_value_port_hint, p_idx, hint)) {
+ info.hint = PropertyHint(hint);
+ }
}
- if (get_script_instance() && get_script_instance()->has_method("_get_input_value_port_hint_string")) {
- info.hint_string = get_script_instance()->call("_get_input_value_port_hint_string", p_idx);
+
+ {
+ String hint_string;
+ if (GDVIRTUAL_CALL(_get_input_value_port_hint_string, p_idx, hint_string)) {
+ info.hint_string = hint_string;
+ }
}
+
return info;
}
PropertyInfo VisualScriptCustomNode::get_output_value_port_info(int p_idx) const {
PropertyInfo info;
- if (get_script_instance() && get_script_instance()->has_method("_get_output_value_port_type")) {
- info.type = Variant::Type(int(get_script_instance()->call("_get_output_value_port_type", p_idx)));
+ {
+ int type;
+ if (GDVIRTUAL_CALL(_get_output_value_port_type, p_idx, type)) {
+ info.type = Variant::Type(type);
+ }
}
- if (get_script_instance() && get_script_instance()->has_method("_get_output_value_port_name")) {
- info.name = get_script_instance()->call("_get_output_value_port_name", p_idx);
+ {
+ String name;
+ if (GDVIRTUAL_CALL(_get_output_value_port_name, p_idx, name)) {
+ info.name = name;
+ }
}
- if (get_script_instance() && get_script_instance()->has_method("_get_output_value_port_hint")) {
- info.hint = PropertyHint(int(get_script_instance()->call("_get_output_value_port_hint", p_idx)));
+ {
+ int hint;
+ if (GDVIRTUAL_CALL(_get_output_value_port_hint, p_idx, hint)) {
+ info.hint = PropertyHint(hint);
+ }
}
- if (get_script_instance() && get_script_instance()->has_method("_get_output_value_port_hint_string")) {
- info.hint_string = get_script_instance()->call("_get_output_value_port_hint_string", p_idx);
+
+ {
+ String hint_string;
+ if (GDVIRTUAL_CALL(_get_output_value_port_hint_string, p_idx, hint_string)) {
+ info.hint_string = hint_string;
+ }
}
return info;
}
@@ -2911,22 +2943,25 @@ VisualScriptCustomNode::TypeGuess VisualScriptCustomNode::guess_output_type(Type
}
String VisualScriptCustomNode::get_caption() const {
- if (get_script_instance() && get_script_instance()->has_method("_get_caption")) {
- return get_script_instance()->call("_get_caption");
+ String ret;
+ if (GDVIRTUAL_CALL(_get_caption, ret)) {
+ return ret;
}
return "CustomNode";
}
String VisualScriptCustomNode::get_text() const {
- if (get_script_instance() && get_script_instance()->has_method("_get_text")) {
- return get_script_instance()->call("_get_text");
+ String ret;
+ if (GDVIRTUAL_CALL(_get_text, ret)) {
+ return ret;
}
return "";
}
String VisualScriptCustomNode::get_category() const {
- if (get_script_instance() && get_script_instance()->has_method("_get_category")) {
- return get_script_instance()->call("_get_category");
+ String ret;
+ if (GDVIRTUAL_CALL(_get_category, ret)) {
+ return ret;
}
return "Custom";
}
@@ -2941,14 +2976,7 @@ public:
virtual int get_working_memory_size() const { return work_mem_size; }
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
- if (node->get_script_instance()) {
-#ifdef DEBUG_ENABLED
- if (!node->get_script_instance()->has_method(VisualScriptLanguage::singleton->_step)) {
- r_error_str = RTR("Custom node has no _step() method, can't process graph.");
- r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
- return 0;
- }
-#endif
+ if (GDVIRTUAL_IS_OVERRIDDEN_PTR(node, _step)) {
Array in_values;
Array out_values;
Array work_mem;
@@ -2969,7 +2997,8 @@ public:
int ret_out;
- Variant ret = node->get_script_instance()->call(VisualScriptLanguage::singleton->_step, in_values, out_values, p_start_mode, work_mem);
+ Variant ret;
+ GDVIRTUAL_CALL_PTR(node, _step, in_values, out_values, p_start_mode, work_mem, ret);
if (ret.get_type() == Variant::STRING) {
r_error_str = ret;
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
@@ -2995,6 +3024,9 @@ public:
}
return ret_out;
+ } else {
+ r_error_str = RTR("Custom node has no _step() method, can't process graph.");
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
}
return 0;
@@ -3008,11 +3040,8 @@ VisualScriptNodeInstance *VisualScriptCustomNode::instantiate(VisualScriptInstan
instance->in_count = get_input_value_port_count();
instance->out_count = get_output_value_port_count();
- if (get_script_instance() && get_script_instance()->has_method("_get_working_memory_size")) {
- instance->work_mem_size = get_script_instance()->call("_get_working_memory_size");
- } else {
- instance->work_mem_size = 0;
- }
+ instance->work_mem_size = 0;
+ GDVIRTUAL_CALL(_get_working_memory_size, instance->work_mem_size);
return instance;
}
@@ -3022,32 +3051,29 @@ void VisualScriptCustomNode::_script_changed() {
}
void VisualScriptCustomNode::_bind_methods() {
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_sequence_port_count"));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_input_sequence_port"));
-
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_sequence_port_text", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_value_port_count"));
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_value_port_count"));
+ GDVIRTUAL_BIND(_get_output_sequence_port_count);
+ GDVIRTUAL_BIND(_has_input_sequence_port);
+ GDVIRTUAL_BIND(_get_output_sequence_port_text, "seq_idx");
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_value_port_type", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_input_value_port_name", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_value_port_hint", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_input_value_port_hint_string", PropertyInfo(Variant::INT, "idx")));
+ GDVIRTUAL_BIND(_get_input_value_port_count);
+ GDVIRTUAL_BIND(_get_input_value_port_type, "input_idx");
+ GDVIRTUAL_BIND(_get_input_value_port_name, "input_idx");
+ GDVIRTUAL_BIND(_get_input_value_port_hint, "input_idx");
+ GDVIRTUAL_BIND(_get_input_value_port_hint_string, "input_idx");
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_value_port_type", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_value_port_name", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_value_port_hint", PropertyInfo(Variant::INT, "idx")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_value_port_hint_string", PropertyInfo(Variant::INT, "idx")));
+ GDVIRTUAL_BIND(_get_output_value_port_count);
+ GDVIRTUAL_BIND(_get_output_value_port_type, "output_idx");
+ GDVIRTUAL_BIND(_get_output_value_port_name, "output_idx");
+ GDVIRTUAL_BIND(_get_output_value_port_hint, "output_idx");
+ GDVIRTUAL_BIND(_get_output_value_port_hint_string, "output_idx");
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_caption"));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_text"));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_category"));
+ GDVIRTUAL_BIND(_get_caption);
+ GDVIRTUAL_BIND(_get_text);
+ GDVIRTUAL_BIND(_get_category);
- BIND_VMETHOD(MethodInfo(Variant::INT, "_get_working_memory_size"));
+ GDVIRTUAL_BIND(_get_working_memory_size);
- MethodInfo stepmi(Variant::NIL, "_step", PropertyInfo(Variant::ARRAY, "inputs"), PropertyInfo(Variant::ARRAY, "outputs"), PropertyInfo(Variant::INT, "start_mode"), PropertyInfo(Variant::ARRAY, "working_mem"));
- stepmi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
- BIND_VMETHOD(stepmi);
+ GDVIRTUAL_BIND(_step, "inputs", "outputs", "start_mode", "working_mem");
BIND_ENUM_CONSTANT(START_MODE_BEGIN_SEQUENCE);
BIND_ENUM_CONSTANT(START_MODE_CONTINUE_SEQUENCE);
@@ -3170,9 +3196,7 @@ VisualScriptNodeInstance *VisualScriptSubCall::instantiate(VisualScriptInstance
}
void VisualScriptSubCall::_bind_methods() {
- MethodInfo scmi(Variant::NIL, "_subcall", PropertyInfo(Variant::NIL, "arguments"));
- scmi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
- BIND_VMETHOD(scmi);
+ // Since this is script only, registering virtual function is no longer valid. Will have to go in docs.
}
VisualScriptSubCall::VisualScriptSubCall() {
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 2390e5c7bc..bf2d8e9683 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -31,6 +31,8 @@
#ifndef VISUAL_SCRIPT_NODES_H
#define VISUAL_SCRIPT_NODES_H
+#include "core/object/gdvirtual.gen.inc"
+#include "core/object/script_language.h"
#include "visual_script.h"
class VisualScriptFunction : public VisualScriptNode {
@@ -47,7 +49,7 @@ class VisualScriptFunction : public VisualScriptNode {
bool stack_less;
int stack_size;
- MultiplayerAPI::RPCMode rpc_mode;
+ Multiplayer::RPCMode rpc_mode;
bool sequenced;
protected:
@@ -94,8 +96,8 @@ public:
void set_return_type(Variant::Type p_type);
Variant::Type get_return_type() const;
- void set_rpc_mode(MultiplayerAPI::RPCMode p_mode);
- MultiplayerAPI::RPCMode get_rpc_mode() const;
+ void set_rpc_mode(Multiplayer::RPCMode p_mode);
+ Multiplayer::RPCMode get_rpc_mode() const;
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
@@ -757,6 +759,30 @@ class VisualScriptCustomNode : public VisualScriptNode {
protected:
static void _bind_methods();
+ friend class VisualScriptNodeInstanceCustomNode;
+ GDVIRTUAL0RC(int, _get_output_sequence_port_count)
+ GDVIRTUAL0RC(bool, _has_input_sequence_port)
+ GDVIRTUAL1RC(String, _get_output_sequence_port_text, int)
+
+ GDVIRTUAL0RC(int, _get_input_value_port_count)
+ GDVIRTUAL1RC(int, _get_input_value_port_type, int)
+ GDVIRTUAL1RC(String, _get_input_value_port_name, int)
+ GDVIRTUAL1RC(int, _get_input_value_port_hint, int)
+ GDVIRTUAL1RC(String, _get_input_value_port_hint_string, int)
+
+ GDVIRTUAL0RC(int, _get_output_value_port_count)
+ GDVIRTUAL1RC(int, _get_output_value_port_type, int)
+ GDVIRTUAL1RC(String, _get_output_value_port_name, int)
+ GDVIRTUAL1RC(int, _get_output_value_port_hint, int)
+ GDVIRTUAL1RC(String, _get_output_value_port_hint_string, int)
+
+ GDVIRTUAL0RC(String, _get_caption)
+ GDVIRTUAL0RC(String, _get_text)
+ GDVIRTUAL0RC(String, _get_category)
+
+ GDVIRTUAL0RC(int, _get_working_memory_size)
+
+ GDVIRTUAL4RC(Variant, _step, Array, Array, int, Array)
public:
enum StartMode { //replicated for step
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index bacb1947be..d8b88d6cd3 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -55,7 +55,7 @@ void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
search_box->accept_event();
TreeItem *root = search_options->get_root();