diff options
Diffstat (limited to 'modules/visual_script/visual_script_nodes.cpp')
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 422 |
1 files changed, 0 insertions, 422 deletions
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 52399d29d0..8ae50c3b48 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -43,9 +43,7 @@ ////////////////////////////////////////// bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value) { - if (p_name == "argument_count") { - int new_argc = p_value; int argc = arguments.size(); if (argc == new_argc) @@ -66,7 +64,6 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value ERR_FAIL_INDEX_V(idx, arguments.size(), false); String what = String(p_name).get_slice("/", 1); if (what == "type") { - Variant::Type new_type = Variant::Type(int(p_value)); arguments.write[idx].type = new_type; ports_changed_notify(); @@ -75,7 +72,6 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value } if (what == "name") { - arguments.write[idx].name = p_value; ports_changed_notify(); return true; @@ -107,7 +103,6 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value } bool VisualScriptFunction::_get(const StringName &p_name, Variant &r_ret) const { - if (p_name == "argument_count") { r_ret = arguments.size(); return true; @@ -149,7 +144,6 @@ bool VisualScriptFunction::_get(const StringName &p_name, Variant &r_ret) const return false; } void VisualScriptFunction::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->push_back(PropertyInfo(Variant::INT, "argument_count", PROPERTY_HINT_RANGE, "0,256")); String argt = "Any"; for (int i = 1; i < Variant::VARIANT_MAX; i++) { @@ -171,35 +165,28 @@ void VisualScriptFunction::_get_property_list(List<PropertyInfo> *p_list) const } int VisualScriptFunction::get_output_sequence_port_count() const { - return 1; } bool VisualScriptFunction::has_input_sequence_port() const { - return false; } int VisualScriptFunction::get_input_value_port_count() const { - return 0; } int VisualScriptFunction::get_output_value_port_count() const { - return arguments.size(); } String VisualScriptFunction::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptFunction::get_input_value_port_info(int p_idx) const { - ERR_FAIL_V(PropertyInfo()); } PropertyInfo VisualScriptFunction::get_output_value_port_info(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, arguments.size(), PropertyInfo()); PropertyInfo out; out.type = arguments[p_idx].type; @@ -210,17 +197,14 @@ PropertyInfo VisualScriptFunction::get_output_value_port_info(int p_idx) const { } String VisualScriptFunction::get_caption() const { - return "Function"; } String VisualScriptFunction::get_text() const { - return get_name(); //use name as function name I guess } void VisualScriptFunction::add_argument(Variant::Type p_type, const String &p_name, int p_index, const PropertyHint p_hint, const String &p_hint_string) { - Argument arg; arg.name = p_name; arg.type = p_type; @@ -234,31 +218,26 @@ void VisualScriptFunction::add_argument(Variant::Type p_type, const String &p_na ports_changed_notify(); } void VisualScriptFunction::set_argument_type(int p_argidx, Variant::Type p_type) { - ERR_FAIL_INDEX(p_argidx, arguments.size()); arguments.write[p_argidx].type = p_type; ports_changed_notify(); } Variant::Type VisualScriptFunction::get_argument_type(int p_argidx) const { - ERR_FAIL_INDEX_V(p_argidx, arguments.size(), Variant::NIL); return arguments[p_argidx].type; } void VisualScriptFunction::set_argument_name(int p_argidx, const String &p_name) { - ERR_FAIL_INDEX(p_argidx, arguments.size()); arguments.write[p_argidx].name = p_name; ports_changed_notify(); } String VisualScriptFunction::get_argument_name(int p_argidx) const { - ERR_FAIL_INDEX_V(p_argidx, arguments.size(), String()); return arguments[p_argidx].name; } void VisualScriptFunction::remove_argument(int p_argidx) { - ERR_FAIL_INDEX(p_argidx, arguments.size()); arguments.remove(p_argidx); @@ -266,7 +245,6 @@ void VisualScriptFunction::remove_argument(int p_argidx) { } int VisualScriptFunction::get_argument_count() const { - return arguments.size(); } @@ -286,7 +264,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - int ac = node->get_argument_count(); for (int i = 0; i < ac; i++) { @@ -310,7 +287,6 @@ public: }; VisualScriptNodeInstance *VisualScriptFunction::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceFunction *instance = memnew(VisualScriptNodeInstanceFunction); instance->node = this; instance->instance = p_instance; @@ -318,7 +294,6 @@ VisualScriptNodeInstance *VisualScriptFunction::instance(VisualScriptInstance *p } VisualScriptFunction::VisualScriptFunction() { - stack_size = 256; stack_less = false; sequenced = true; @@ -335,23 +310,19 @@ bool VisualScriptFunction::is_stack_less() const { } void VisualScriptFunction::set_sequenced(bool p_enable) { - sequenced = p_enable; } bool VisualScriptFunction::is_sequenced() const { - return sequenced; } void VisualScriptFunction::set_stack_size(int p_size) { - ERR_FAIL_COND(p_size < 1 || p_size > 100000); stack_size = p_size; } int VisualScriptFunction::get_stack_size() const { - return stack_size; } @@ -418,9 +389,7 @@ bool VisualScriptLists::is_output_port_type_editable() const { // for the inspector bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { - if (p_name == "input_count" && is_input_port_editable()) { - int new_argc = p_value; int argc = inputports.size(); if (argc == new_argc) @@ -441,7 +410,6 @@ bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_INDEX_V(idx, inputports.size(), false); String what = String(p_name).get_slice("/", 1); if (what == "type") { - Variant::Type new_type = Variant::Type(int(p_value)); inputports.write[idx].type = new_type; ports_changed_notify(); @@ -450,7 +418,6 @@ bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { } if (what == "name") { - inputports.write[idx].name = p_value; ports_changed_notify(); return true; @@ -458,7 +425,6 @@ bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { } if (p_name == "output_count" && is_output_port_editable()) { - int new_argc = p_value; int argc = outputports.size(); if (argc == new_argc) @@ -479,7 +445,6 @@ bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_INDEX_V(idx, outputports.size(), false); String what = String(p_name).get_slice("/", 1); if (what == "type") { - Variant::Type new_type = Variant::Type(int(p_value)); outputports.write[idx].type = new_type; ports_changed_notify(); @@ -488,7 +453,6 @@ bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { } if (what == "name") { - outputports.write[idx].name = p_value; ports_changed_notify(); return true; @@ -504,7 +468,6 @@ bool VisualScriptLists::_set(const StringName &p_name, const Variant &p_value) { return false; } bool VisualScriptLists::_get(const StringName &p_name, Variant &r_ret) const { - if (p_name == "input_count" && is_input_port_editable()) { r_ret = inputports.size(); return true; @@ -549,7 +512,6 @@ bool VisualScriptLists::_get(const StringName &p_name, Variant &r_ret) const { return false; } void VisualScriptLists::_get_property_list(List<PropertyInfo> *p_list) const { - if (is_input_port_editable()) { p_list->push_back(PropertyInfo(Variant::INT, "input_count", PROPERTY_HINT_RANGE, "0,256")); String argt = "Any"; @@ -580,7 +542,6 @@ void VisualScriptLists::_get_property_list(List<PropertyInfo> *p_list) const { // input data port interaction void VisualScriptLists::add_input_data_port(Variant::Type p_type, const String &p_name, int p_index) { - if (!is_input_port_editable()) return; @@ -596,7 +557,6 @@ void VisualScriptLists::add_input_data_port(Variant::Type p_type, const String & _change_notify(); } void VisualScriptLists::set_input_data_port_type(int p_idx, Variant::Type p_type) { - if (!is_input_port_type_editable()) return; @@ -607,7 +567,6 @@ void VisualScriptLists::set_input_data_port_type(int p_idx, Variant::Type p_type _change_notify(); } void VisualScriptLists::set_input_data_port_name(int p_idx, const String &p_name) { - if (!is_input_port_name_editable()) return; @@ -618,7 +577,6 @@ void VisualScriptLists::set_input_data_port_name(int p_idx, const String &p_name _change_notify(); } void VisualScriptLists::remove_input_data_port(int p_argidx) { - if (!is_input_port_editable()) return; @@ -632,7 +590,6 @@ void VisualScriptLists::remove_input_data_port(int p_argidx) { // output data port interaction void VisualScriptLists::add_output_data_port(Variant::Type p_type, const String &p_name, int p_index) { - if (!is_output_port_editable()) return; @@ -648,7 +605,6 @@ void VisualScriptLists::add_output_data_port(Variant::Type p_type, const String _change_notify(); } void VisualScriptLists::set_output_data_port_type(int p_idx, Variant::Type p_type) { - if (!is_output_port_type_editable()) return; @@ -659,7 +615,6 @@ void VisualScriptLists::set_output_data_port_type(int p_idx, Variant::Type p_typ _change_notify(); } void VisualScriptLists::set_output_data_port_name(int p_idx, const String &p_name) { - if (!is_output_port_name_editable()) return; @@ -670,7 +625,6 @@ void VisualScriptLists::set_output_data_port_name(int p_idx, const String &p_nam _change_notify(); } void VisualScriptLists::remove_output_data_port(int p_argidx) { - if (!is_output_port_editable()) return; @@ -763,7 +717,6 @@ public: virtual int get_working_memory_size() const { return 0; } 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 (input_count > 0) { Array arr; for (int i = 0; i < input_count; i++) @@ -778,7 +731,6 @@ public: }; VisualScriptNodeInstance *VisualScriptComposeArray::instance(VisualScriptInstance *p_instance) { - VisualScriptComposeArrayNode *instance = memnew(VisualScriptComposeArrayNode); instance->input_count = inputports.size(); return instance; @@ -795,31 +747,25 @@ VisualScriptComposeArray::VisualScriptComposeArray() { ////////////////////////////////////////// int VisualScriptOperator::get_output_sequence_port_count() const { - return 0; } bool VisualScriptOperator::has_input_sequence_port() const { - return false; } int VisualScriptOperator::get_input_value_port_count() const { - return (op == Variant::OP_BIT_NEGATE || op == Variant::OP_NOT || op == Variant::OP_NEGATE || op == Variant::OP_POSITIVE) ? 1 : 2; } int VisualScriptOperator::get_output_value_port_count() const { - return 1; } String VisualScriptOperator::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const { - static const Variant::Type port_types[Variant::OP_MAX][2] = { { Variant::NIL, Variant::NIL }, //OP_EQUAL, { Variant::NIL, Variant::NIL }, //OP_NOT_EQUAL, @@ -937,7 +883,6 @@ static const char *op_names[] = { }; String VisualScriptOperator::get_caption() const { - static const wchar_t *op_names[] = { //comparison L"A = B", //OP_EQUAL, @@ -974,7 +919,6 @@ String VisualScriptOperator::get_caption() const { } void VisualScriptOperator::set_operator(Variant::Operator p_op) { - if (op == p_op) return; op = p_op; @@ -982,12 +926,10 @@ void VisualScriptOperator::set_operator(Variant::Operator p_op) { } Variant::Operator VisualScriptOperator::get_operator() const { - return op; } void VisualScriptOperator::set_typed(Variant::Type p_op) { - if (typed == p_op) return; @@ -996,12 +938,10 @@ void VisualScriptOperator::set_typed(Variant::Type p_op) { } Variant::Type VisualScriptOperator::get_typed() const { - return typed; } void VisualScriptOperator::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_operator", "op"), &VisualScriptOperator::set_operator); ClassDB::bind_method(D_METHOD("get_operator"), &VisualScriptOperator::get_operator); @@ -1032,17 +972,14 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - bool valid; if (unary) { - Variant::evaluate(op, *p_inputs[0], Variant(), *p_outputs[0], valid); } else { Variant::evaluate(op, *p_inputs[0], *p_inputs[1], *p_outputs[0], valid); } if (!valid) { - r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; if (p_outputs[0]->get_type() == Variant::STRING) { r_error_str = *p_outputs[0]; @@ -1059,7 +996,6 @@ public: }; VisualScriptNodeInstance *VisualScriptOperator::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceOperator *instance = memnew(VisualScriptNodeInstanceOperator); instance->unary = get_input_value_port_count() == 1; instance->op = op; @@ -1067,14 +1003,12 @@ VisualScriptNodeInstance *VisualScriptOperator::instance(VisualScriptInstance *p } VisualScriptOperator::VisualScriptOperator() { - op = Variant::OP_ADD; typed = Variant::NIL; } template <Variant::Operator OP> static Ref<VisualScriptNode> create_op_node(const String &p_name) { - Ref<VisualScriptOperator> node; node.instance(); node->set_operator(OP); @@ -1086,31 +1020,25 @@ static Ref<VisualScriptNode> create_op_node(const String &p_name) { ////////////////////////////////////////// int VisualScriptSelect::get_output_sequence_port_count() const { - return 0; } bool VisualScriptSelect::has_input_sequence_port() const { - return false; } int VisualScriptSelect::get_input_value_port_count() const { - return 3; } int VisualScriptSelect::get_output_value_port_count() const { - return 1; } String VisualScriptSelect::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptSelect::get_input_value_port_info(int p_idx) const { - if (p_idx == 0) { return PropertyInfo(Variant::BOOL, "cond"); } else if (p_idx == 1) { @@ -1120,22 +1048,18 @@ PropertyInfo VisualScriptSelect::get_input_value_port_info(int p_idx) const { } } PropertyInfo VisualScriptSelect::get_output_value_port_info(int p_idx) const { - return PropertyInfo(typed, "out"); } String VisualScriptSelect::get_caption() const { - return "Select"; } String VisualScriptSelect::get_text() const { - return "a if cond, else b"; } void VisualScriptSelect::set_typed(Variant::Type p_op) { - if (typed == p_op) return; @@ -1144,12 +1068,10 @@ void VisualScriptSelect::set_typed(Variant::Type p_op) { } Variant::Type VisualScriptSelect::get_typed() const { - return typed; } void VisualScriptSelect::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_typed", "type"), &VisualScriptSelect::set_typed); ClassDB::bind_method(D_METHOD("get_typed"), &VisualScriptSelect::get_typed); @@ -1166,7 +1088,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - bool cond = *p_inputs[0]; if (cond) *p_outputs[0] = *p_inputs[1]; @@ -1178,13 +1099,11 @@ public: }; VisualScriptNodeInstance *VisualScriptSelect::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceSelect *instance = memnew(VisualScriptNodeInstanceSelect); return instance; } VisualScriptSelect::VisualScriptSelect() { - typed = Variant::NIL; } @@ -1193,36 +1112,29 @@ VisualScriptSelect::VisualScriptSelect() { ////////////////////////////////////////// int VisualScriptVariableGet::get_output_sequence_port_count() const { - return 0; } bool VisualScriptVariableGet::has_input_sequence_port() const { - return false; } int VisualScriptVariableGet::get_input_value_port_count() const { - return 0; } int VisualScriptVariableGet::get_output_value_port_count() const { - return 1; } String VisualScriptVariableGet::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptVariableGet::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptVariableGet::get_output_value_port_info(int p_idx) const { - PropertyInfo pinfo; pinfo.name = "value"; if (get_visual_script().is_valid() && get_visual_script()->has_variable(variable)) { @@ -1235,11 +1147,9 @@ PropertyInfo VisualScriptVariableGet::get_output_value_port_info(int p_idx) cons } String VisualScriptVariableGet::get_caption() const { - return "Get " + variable; } void VisualScriptVariableGet::set_variable(StringName p_variable) { - if (variable == p_variable) return; variable = p_variable; @@ -1247,12 +1157,10 @@ void VisualScriptVariableGet::set_variable(StringName p_variable) { } StringName VisualScriptVariableGet::get_variable() const { - return variable; } void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const { - if (property.name == "var_name" && get_visual_script().is_valid()) { Ref<VisualScript> vs = get_visual_script(); List<StringName> vars; @@ -1272,7 +1180,6 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const { } void VisualScriptVariableGet::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_variable", "name"), &VisualScriptVariableGet::set_variable); ClassDB::bind_method(D_METHOD("get_variable"), &VisualScriptVariableGet::get_variable); @@ -1286,7 +1193,6 @@ public: StringName variable; 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 (!instance->get_variable(variable, p_outputs[0])) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = RTR("VariableGet not found in script: ") + "'" + String(variable) + "'"; @@ -1297,7 +1203,6 @@ public: }; VisualScriptNodeInstance *VisualScriptVariableGet::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceVariableGet *instance = memnew(VisualScriptNodeInstanceVariableGet); instance->node = this; instance->instance = p_instance; @@ -1312,31 +1217,25 @@ VisualScriptVariableGet::VisualScriptVariableGet() { ////////////////////////////////////////// int VisualScriptVariableSet::get_output_sequence_port_count() const { - return 1; } bool VisualScriptVariableSet::has_input_sequence_port() const { - return true; } int VisualScriptVariableSet::get_input_value_port_count() const { - return 1; } int VisualScriptVariableSet::get_output_value_port_count() const { - return 0; } String VisualScriptVariableSet::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptVariableSet::get_input_value_port_info(int p_idx) const { - PropertyInfo pinfo; pinfo.name = "set"; if (get_visual_script().is_valid() && get_visual_script()->has_variable(variable)) { @@ -1349,17 +1248,14 @@ PropertyInfo VisualScriptVariableSet::get_input_value_port_info(int p_idx) const } PropertyInfo VisualScriptVariableSet::get_output_value_port_info(int p_idx) const { - return PropertyInfo(); } String VisualScriptVariableSet::get_caption() const { - return "Set " + variable; } void VisualScriptVariableSet::set_variable(StringName p_variable) { - if (variable == p_variable) return; variable = p_variable; @@ -1367,12 +1263,10 @@ void VisualScriptVariableSet::set_variable(StringName p_variable) { } StringName VisualScriptVariableSet::get_variable() const { - return variable; } void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const { - if (property.name == "var_name" && get_visual_script().is_valid()) { Ref<VisualScript> vs = get_visual_script(); List<StringName> vars; @@ -1392,7 +1286,6 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const { } void VisualScriptVariableSet::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_variable", "name"), &VisualScriptVariableSet::set_variable); ClassDB::bind_method(D_METHOD("get_variable"), &VisualScriptVariableSet::get_variable); @@ -1408,9 +1301,7 @@ public: //virtual int get_working_memory_size() const { return 0; } 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 (!instance->set_variable(variable, *p_inputs[0])) { - r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = RTR("VariableSet not found in script: ") + "'" + String(variable) + "'"; } @@ -1420,7 +1311,6 @@ public: }; VisualScriptNodeInstance *VisualScriptVariableSet::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceVariableSet *instance = memnew(VisualScriptNodeInstanceVariableSet); instance->node = this; instance->instance = p_instance; @@ -1435,36 +1325,29 @@ VisualScriptVariableSet::VisualScriptVariableSet() { ////////////////////////////////////////// int VisualScriptConstant::get_output_sequence_port_count() const { - return 0; } bool VisualScriptConstant::has_input_sequence_port() const { - return false; } int VisualScriptConstant::get_input_value_port_count() const { - return 0; } int VisualScriptConstant::get_output_value_port_count() const { - return 1; } String VisualScriptConstant::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptConstant::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptConstant::get_output_value_port_info(int p_idx) const { - PropertyInfo pinfo; pinfo.name = String(value); pinfo.type = type; @@ -1472,12 +1355,10 @@ PropertyInfo VisualScriptConstant::get_output_value_port_info(int p_idx) const { } String VisualScriptConstant::get_caption() const { - return "Constant"; } void VisualScriptConstant::set_constant_type(Variant::Type p_type) { - if (type == p_type) return; @@ -1489,12 +1370,10 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) { } Variant::Type VisualScriptConstant::get_constant_type() const { - return type; } void VisualScriptConstant::set_constant_value(Variant p_value) { - if (value == p_value) return; @@ -1502,12 +1381,10 @@ void VisualScriptConstant::set_constant_value(Variant p_value) { ports_changed_notify(); } Variant VisualScriptConstant::get_constant_value() const { - return value; } void VisualScriptConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "value") { property.type = type; if (type == Variant::NIL) @@ -1516,7 +1393,6 @@ void VisualScriptConstant::_validate_property(PropertyInfo &property) const { } void VisualScriptConstant::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_constant_type", "type"), &VisualScriptConstant::set_constant_type); ClassDB::bind_method(D_METHOD("get_constant_type"), &VisualScriptConstant::get_constant_type); @@ -1538,21 +1414,18 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = constant; return 0; } }; VisualScriptNodeInstance *VisualScriptConstant::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceConstant *instance = memnew(VisualScriptNodeInstanceConstant); instance->constant = value; return instance; } VisualScriptConstant::VisualScriptConstant() { - type = Variant::NIL; } @@ -1561,36 +1434,29 @@ VisualScriptConstant::VisualScriptConstant() { ////////////////////////////////////////// int VisualScriptPreload::get_output_sequence_port_count() const { - return 0; } bool VisualScriptPreload::has_input_sequence_port() const { - return false; } int VisualScriptPreload::get_input_value_port_count() const { - return 0; } int VisualScriptPreload::get_output_value_port_count() const { - return 1; } String VisualScriptPreload::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptPreload::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const { - PropertyInfo pinfo; pinfo.type = Variant::OBJECT; if (preload.is_valid()) { @@ -1611,12 +1477,10 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const { } String VisualScriptPreload::get_caption() const { - return "Preload"; } void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) { - if (preload == p_preload) return; @@ -1625,12 +1489,10 @@ void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) { } Ref<Resource> VisualScriptPreload::get_preload() const { - return preload; } void VisualScriptPreload::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_preload", "resource"), &VisualScriptPreload::set_preload); ClassDB::bind_method(D_METHOD("get_preload"), &VisualScriptPreload::get_preload); @@ -1643,14 +1505,12 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = preload; return 0; } }; VisualScriptNodeInstance *VisualScriptPreload::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstancePreload *instance = memnew(VisualScriptNodeInstancePreload); instance->preload = preload; return instance; @@ -1664,31 +1524,25 @@ VisualScriptPreload::VisualScriptPreload() { ////////////////////////////////////////// int VisualScriptIndexGet::get_output_sequence_port_count() const { - return 0; } bool VisualScriptIndexGet::has_input_sequence_port() const { - return false; } int VisualScriptIndexGet::get_input_value_port_count() const { - return 2; } int VisualScriptIndexGet::get_output_value_port_count() const { - return 1; } String VisualScriptIndexGet::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptIndexGet::get_input_value_port_info(int p_idx) const { - if (p_idx == 0) { return PropertyInfo(Variant::NIL, "base"); } else { @@ -1697,12 +1551,10 @@ PropertyInfo VisualScriptIndexGet::get_input_value_port_info(int p_idx) const { } PropertyInfo VisualScriptIndexGet::get_output_value_port_info(int p_idx) const { - return PropertyInfo(); } String VisualScriptIndexGet::get_caption() const { - return "Get Index"; } @@ -1711,7 +1563,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - bool valid; *p_outputs[0] = p_inputs[0]->get(*p_inputs[1], &valid); @@ -1724,7 +1575,6 @@ public: }; VisualScriptNodeInstance *VisualScriptIndexGet::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceIndexGet *instance = memnew(VisualScriptNodeInstanceIndexGet); return instance; } @@ -1736,31 +1586,25 @@ VisualScriptIndexGet::VisualScriptIndexGet() { ////////////////////////////////////////// int VisualScriptIndexSet::get_output_sequence_port_count() const { - return 1; } bool VisualScriptIndexSet::has_input_sequence_port() const { - return true; } int VisualScriptIndexSet::get_input_value_port_count() const { - return 3; } int VisualScriptIndexSet::get_output_value_port_count() const { - return 0; } String VisualScriptIndexSet::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptIndexSet::get_input_value_port_info(int p_idx) const { - if (p_idx == 0) { return PropertyInfo(Variant::NIL, "base"); } else if (p_idx == 1) { @@ -1772,12 +1616,10 @@ PropertyInfo VisualScriptIndexSet::get_input_value_port_info(int p_idx) const { } PropertyInfo VisualScriptIndexSet::get_output_value_port_info(int p_idx) const { - return PropertyInfo(); } String VisualScriptIndexSet::get_caption() const { - return "Set Index"; } @@ -1786,7 +1628,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - bool valid; *p_outputs[0] = *p_inputs[0]; p_outputs[0]->set(*p_inputs[1], *p_inputs[2], &valid); @@ -1800,7 +1641,6 @@ public: }; VisualScriptNodeInstance *VisualScriptIndexSet::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceIndexSet *instance = memnew(VisualScriptNodeInstanceIndexSet); return instance; } @@ -1812,31 +1652,25 @@ VisualScriptIndexSet::VisualScriptIndexSet() { ////////////////////////////////////////// int VisualScriptGlobalConstant::get_output_sequence_port_count() const { - return 0; } bool VisualScriptGlobalConstant::has_input_sequence_port() const { - return false; } int VisualScriptGlobalConstant::get_input_value_port_count() const { - return 0; } int VisualScriptGlobalConstant::get_output_value_port_count() const { - return 1; } String VisualScriptGlobalConstant::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptGlobalConstant::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } @@ -1846,12 +1680,10 @@ PropertyInfo VisualScriptGlobalConstant::get_output_value_port_info(int p_idx) c } String VisualScriptGlobalConstant::get_caption() const { - return "Global Constant"; } void VisualScriptGlobalConstant::set_global_constant(int p_which) { - index = p_which; _change_notify(); ports_changed_notify(); @@ -1867,28 +1699,24 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = GlobalConstants::get_global_constant_value(index); return 0; } }; VisualScriptNodeInstance *VisualScriptGlobalConstant::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceGlobalConstant *instance = memnew(VisualScriptNodeInstanceGlobalConstant); instance->index = index; return instance; } void VisualScriptGlobalConstant::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_global_constant", "index"), &VisualScriptGlobalConstant::set_global_constant); ClassDB::bind_method(D_METHOD("get_global_constant"), &VisualScriptGlobalConstant::get_global_constant); String cc; for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) { - if (i > 0) cc += ","; cc += GlobalConstants::get_global_constant_name(i); @@ -1897,7 +1725,6 @@ void VisualScriptGlobalConstant::_bind_methods() { } VisualScriptGlobalConstant::VisualScriptGlobalConstant() { - index = 0; } @@ -1906,31 +1733,25 @@ VisualScriptGlobalConstant::VisualScriptGlobalConstant() { ////////////////////////////////////////// int VisualScriptClassConstant::get_output_sequence_port_count() const { - return 0; } bool VisualScriptClassConstant::has_input_sequence_port() const { - return false; } int VisualScriptClassConstant::get_input_value_port_count() const { - return 0; } int VisualScriptClassConstant::get_output_value_port_count() const { - return 1; } String VisualScriptClassConstant::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptClassConstant::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } @@ -1943,12 +1764,10 @@ PropertyInfo VisualScriptClassConstant::get_output_value_port_info(int p_idx) co } String VisualScriptClassConstant::get_caption() const { - return "Class Constant"; } void VisualScriptClassConstant::set_class_constant(const StringName &p_which) { - name = p_which; _change_notify(); ports_changed_notify(); @@ -1959,7 +1778,6 @@ StringName VisualScriptClassConstant::get_class_constant() { } void VisualScriptClassConstant::set_base_type(const StringName &p_which) { - base_type = p_which; List<String> constants; ClassDB::get_integer_constant_list(base_type, &constants, true); @@ -1992,7 +1810,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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 (!valid) { r_error_str = "Invalid constant name, pick a valid class constant."; r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; @@ -2004,16 +1821,13 @@ public: }; VisualScriptNodeInstance *VisualScriptClassConstant::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceClassConstant *instance = memnew(VisualScriptNodeInstanceClassConstant); instance->value = ClassDB::get_integer_constant(base_type, name, &instance->valid); return instance; } void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { - List<String> constants; ClassDB::get_integer_constant_list(base_type, &constants, true); @@ -2028,7 +1842,6 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const } void VisualScriptClassConstant::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_class_constant", "name"), &VisualScriptClassConstant::set_class_constant); ClassDB::bind_method(D_METHOD("get_class_constant"), &VisualScriptClassConstant::get_class_constant); @@ -2040,7 +1853,6 @@ void VisualScriptClassConstant::_bind_methods() { } VisualScriptClassConstant::VisualScriptClassConstant() { - base_type = "Object"; } @@ -2049,41 +1861,33 @@ VisualScriptClassConstant::VisualScriptClassConstant() { ////////////////////////////////////////// int VisualScriptBasicTypeConstant::get_output_sequence_port_count() const { - return 0; } bool VisualScriptBasicTypeConstant::has_input_sequence_port() const { - return false; } int VisualScriptBasicTypeConstant::get_input_value_port_count() const { - return 0; } int VisualScriptBasicTypeConstant::get_output_value_port_count() const { - return 1; } String VisualScriptBasicTypeConstant::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptBasicTypeConstant::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptBasicTypeConstant::get_output_value_port_info(int p_idx) const { - return PropertyInfo(type, "value"); } String VisualScriptBasicTypeConstant::get_caption() const { - return "Basic Constant"; } @@ -2096,7 +1900,6 @@ String VisualScriptBasicTypeConstant::get_text() const { } void VisualScriptBasicTypeConstant::set_basic_type_constant(const StringName &p_which) { - name = p_which; _change_notify(); ports_changed_notify(); @@ -2107,7 +1910,6 @@ StringName VisualScriptBasicTypeConstant::get_basic_type_constant() const { } void VisualScriptBasicTypeConstant::set_basic_type(Variant::Type p_which) { - type = p_which; List<StringName> constants; @@ -2141,7 +1943,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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 (!valid) { r_error_str = "Invalid constant name, pick a valid basic type constant."; r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; @@ -2153,16 +1954,13 @@ public: }; VisualScriptNodeInstance *VisualScriptBasicTypeConstant::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceBasicTypeConstant *instance = memnew(VisualScriptNodeInstanceBasicTypeConstant); instance->value = Variant::get_constant_value(type, name, &instance->valid); return instance; } void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { - List<StringName> constants; Variant::get_constants_for_type(type, &constants); @@ -2181,7 +1979,6 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c } void VisualScriptBasicTypeConstant::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_basic_type", "name"), &VisualScriptBasicTypeConstant::set_basic_type); ClassDB::bind_method(D_METHOD("get_basic_type"), &VisualScriptBasicTypeConstant::get_basic_type); @@ -2198,7 +1995,6 @@ void VisualScriptBasicTypeConstant::_bind_methods() { } VisualScriptBasicTypeConstant::VisualScriptBasicTypeConstant() { - type = Variant::NIL; } @@ -2229,46 +2025,37 @@ double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX] = { }; int VisualScriptMathConstant::get_output_sequence_port_count() const { - return 0; } bool VisualScriptMathConstant::has_input_sequence_port() const { - return false; } int VisualScriptMathConstant::get_input_value_port_count() const { - return 0; } int VisualScriptMathConstant::get_output_value_port_count() const { - return 1; } String VisualScriptMathConstant::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptMathConstant::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptMathConstant::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::FLOAT, const_name[constant]); } String VisualScriptMathConstant::get_caption() const { - return "Math Constant"; } void VisualScriptMathConstant::set_math_constant(MathConstant p_which) { - constant = p_which; _change_notify(); ports_changed_notify(); @@ -2284,28 +2071,24 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = value; return 0; } }; VisualScriptNodeInstance *VisualScriptMathConstant::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceMathConstant *instance = memnew(VisualScriptNodeInstanceMathConstant); instance->value = const_value[constant]; return instance; } void VisualScriptMathConstant::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_math_constant", "which"), &VisualScriptMathConstant::set_math_constant); ClassDB::bind_method(D_METHOD("get_math_constant"), &VisualScriptMathConstant::get_math_constant); String cc; for (int i = 0; i < MATH_CONSTANT_MAX; i++) { - if (i > 0) cc += ","; cc += const_name[i]; @@ -2324,7 +2107,6 @@ void VisualScriptMathConstant::_bind_methods() { } VisualScriptMathConstant::VisualScriptMathConstant() { - constant = MATH_CONSTANT_ONE; } @@ -2333,46 +2115,37 @@ VisualScriptMathConstant::VisualScriptMathConstant() { ////////////////////////////////////////// int VisualScriptEngineSingleton::get_output_sequence_port_count() const { - return 0; } bool VisualScriptEngineSingleton::has_input_sequence_port() const { - return false; } int VisualScriptEngineSingleton::get_input_value_port_count() const { - return 0; } int VisualScriptEngineSingleton::get_output_value_port_count() const { - return 1; } String VisualScriptEngineSingleton::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptEngineSingleton::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptEngineSingleton::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, singleton); } String VisualScriptEngineSingleton::get_caption() const { - return "Get Engine Singleton"; } void VisualScriptEngineSingleton::set_singleton(const String &p_string) { - singleton = p_string; _change_notify(); @@ -2390,21 +2163,18 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = singleton; return 0; } }; VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton); 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 = Engine::get_singleton()->get_singleton_object(singleton); TypeGuess tg; tg.type = Variant::OBJECT; @@ -2417,7 +2187,6 @@ VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output } void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) const { - String cc; List<Engine::Singleton> singletons; @@ -2438,7 +2207,6 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con } void VisualScriptEngineSingleton::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_singleton", "name"), &VisualScriptEngineSingleton::set_singleton); ClassDB::bind_method(D_METHOD("get_singleton"), &VisualScriptEngineSingleton::get_singleton); @@ -2446,7 +2214,6 @@ void VisualScriptEngineSingleton::_bind_methods() { } VisualScriptEngineSingleton::VisualScriptEngineSingleton() { - singleton = String(); } @@ -2455,46 +2222,37 @@ VisualScriptEngineSingleton::VisualScriptEngineSingleton() { ////////////////////////////////////////// int VisualScriptSceneNode::get_output_sequence_port_count() const { - return 0; } bool VisualScriptSceneNode::has_input_sequence_port() const { - return false; } int VisualScriptSceneNode::get_input_value_port_count() const { - return 0; } int VisualScriptSceneNode::get_output_value_port_count() const { - return 1; } String VisualScriptSceneNode::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptSceneNode::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptSceneNode::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, path.simplified()); } String VisualScriptSceneNode::get_caption() const { - return "Get Scene Node"; } void VisualScriptSceneNode::set_node_path(const NodePath &p_path) { - path = p_path; _change_notify(); ports_changed_notify(); @@ -2513,7 +2271,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - Node *node = Object::cast_to<Node>(instance->get_owner_ptr()); if (!node) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; @@ -2535,7 +2292,6 @@ public: }; VisualScriptNodeInstance *VisualScriptSceneNode::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceSceneNode *instance = memnew(VisualScriptNodeInstanceSceneNode); instance->node = this; instance->instance = p_instance; @@ -2546,7 +2302,6 @@ VisualScriptNodeInstance *VisualScriptSceneNode::instance(VisualScriptInstance * #ifdef TOOLS_ENABLED static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) { - if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) return nullptr; @@ -2567,7 +2322,6 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const #endif VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGuess *p_inputs, int p_output) const { - VisualScriptSceneNode::TypeGuess tg; tg.type = Variant::OBJECT; tg.gdclass = "Node"; @@ -2604,10 +2358,8 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu } void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { - #ifdef TOOLS_ENABLED if (property.name == "node_path") { - Ref<Script> script = get_visual_script(); if (!script.is_valid()) return; @@ -2634,7 +2386,6 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { } void VisualScriptSceneNode::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_node_path", "path"), &VisualScriptSceneNode::set_node_path); ClassDB::bind_method(D_METHOD("get_node_path"), &VisualScriptSceneNode::get_node_path); @@ -2642,7 +2393,6 @@ void VisualScriptSceneNode::_bind_methods() { } VisualScriptSceneNode::VisualScriptSceneNode() { - path = String("."); } @@ -2651,41 +2401,33 @@ VisualScriptSceneNode::VisualScriptSceneNode() { ////////////////////////////////////////// int VisualScriptSceneTree::get_output_sequence_port_count() const { - return 0; } bool VisualScriptSceneTree::has_input_sequence_port() const { - return false; } int VisualScriptSceneTree::get_input_value_port_count() const { - return 0; } int VisualScriptSceneTree::get_output_value_port_count() const { - return 1; } String VisualScriptSceneTree::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptSceneTree::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptSceneTree::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, "Scene Tree", PROPERTY_HINT_TYPE_STRING, "SceneTree"); } String VisualScriptSceneTree::get_caption() const { - return "Get Scene Tree"; } @@ -2697,7 +2439,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - Node *node = Object::cast_to<Node>(instance->get_owner_ptr()); if (!node) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; @@ -2719,7 +2460,6 @@ public: }; VisualScriptNodeInstance *VisualScriptSceneTree::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceSceneTree *instance = memnew(VisualScriptNodeInstanceSceneTree); instance->node = this; instance->instance = p_instance; @@ -2727,7 +2467,6 @@ VisualScriptNodeInstance *VisualScriptSceneTree::instance(VisualScriptInstance * } VisualScriptSceneTree::TypeGuess VisualScriptSceneTree::guess_output_type(TypeGuess *p_inputs, int p_output) const { - TypeGuess tg; tg.type = Variant::OBJECT; tg.gdclass = "SceneTree"; @@ -2748,46 +2487,37 @@ VisualScriptSceneTree::VisualScriptSceneTree() { ////////////////////////////////////////// int VisualScriptResourcePath::get_output_sequence_port_count() const { - return 0; } bool VisualScriptResourcePath::has_input_sequence_port() const { - return false; } int VisualScriptResourcePath::get_input_value_port_count() const { - return 0; } int VisualScriptResourcePath::get_output_value_port_count() const { - return 1; } String VisualScriptResourcePath::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptResourcePath::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptResourcePath::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::STRING, path); } String VisualScriptResourcePath::get_caption() const { - return "Resource Path"; } void VisualScriptResourcePath::set_resource_path(const String &p_path) { - path = p_path; _change_notify(); ports_changed_notify(); @@ -2804,21 +2534,18 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = path; return 0; } }; VisualScriptNodeInstance *VisualScriptResourcePath::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceResourcePath *instance = memnew(VisualScriptNodeInstanceResourcePath); instance->path = path; return instance; } void VisualScriptResourcePath::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_resource_path", "path"), &VisualScriptResourcePath::set_resource_path); ClassDB::bind_method(D_METHOD("get_resource_path"), &VisualScriptResourcePath::get_resource_path); @@ -2826,7 +2553,6 @@ void VisualScriptResourcePath::_bind_methods() { } VisualScriptResourcePath::VisualScriptResourcePath() { - path = ""; } @@ -2835,36 +2561,29 @@ VisualScriptResourcePath::VisualScriptResourcePath() { ////////////////////////////////////////// int VisualScriptSelf::get_output_sequence_port_count() const { - return 0; } bool VisualScriptSelf::has_input_sequence_port() const { - return false; } int VisualScriptSelf::get_input_value_port_count() const { - return 0; } int VisualScriptSelf::get_output_value_port_count() const { - return 1; } String VisualScriptSelf::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptSelf::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptSelf::get_output_value_port_info(int p_idx) const { - String type_name; if (get_visual_script().is_valid()) type_name = get_visual_script()->get_instance_base_type(); @@ -2875,7 +2594,6 @@ PropertyInfo VisualScriptSelf::get_output_value_port_info(int p_idx) const { } String VisualScriptSelf::get_caption() const { - return "Get Self"; } @@ -2886,21 +2604,18 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - *p_outputs[0] = instance->get_owner_ptr(); return 0; } }; VisualScriptNodeInstance *VisualScriptSelf::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceSelf *instance = memnew(VisualScriptNodeInstanceSelf); instance->instance = p_instance; return instance; } VisualScriptSelf::TypeGuess VisualScriptSelf::guess_output_type(TypeGuess *p_inputs, int p_output) const { - VisualScriptSceneNode::TypeGuess tg; tg.type = Variant::OBJECT; tg.gdclass = "Object"; @@ -2926,7 +2641,6 @@ 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"); } @@ -2934,7 +2648,6 @@ int VisualScriptCustomNode::get_output_sequence_port_count() const { } 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"); } @@ -2942,14 +2655,12 @@ bool VisualScriptCustomNode::has_input_sequence_port() const { } 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"); } 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"); } @@ -2957,7 +2668,6 @@ int VisualScriptCustomNode::get_output_value_port_count() const { } 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); } @@ -2966,7 +2676,6 @@ 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))); @@ -2978,7 +2687,6 @@ PropertyInfo VisualScriptCustomNode::get_input_value_port_info(int p_idx) const } 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))); @@ -2990,7 +2698,6 @@ PropertyInfo VisualScriptCustomNode::get_output_value_port_info(int p_idx) const } String VisualScriptCustomNode::get_caption() const { - if (get_script_instance() && get_script_instance()->has_method("_get_caption")) { return get_script_instance()->call("_get_caption"); } @@ -2998,7 +2705,6 @@ String VisualScriptCustomNode::get_caption() const { } String VisualScriptCustomNode::get_text() const { - if (get_script_instance() && get_script_instance()->has_method("_get_text")) { return get_script_instance()->call("_get_text"); } @@ -3006,7 +2712,6 @@ String VisualScriptCustomNode::get_text() const { } String VisualScriptCustomNode::get_category() const { - if (get_script_instance() && get_script_instance()->has_method("_get_category")) { return get_script_instance()->call("_get_category"); } @@ -3023,7 +2728,6 @@ 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)) { @@ -3085,7 +2789,6 @@ public: }; VisualScriptNodeInstance *VisualScriptCustomNode::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceCustomNode *instance = memnew(VisualScriptNodeInstanceCustomNode); instance->instance = p_instance; instance->node = this; @@ -3106,7 +2809,6 @@ 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")); @@ -3150,21 +2852,17 @@ VisualScriptCustomNode::VisualScriptCustomNode() { ////////////////////////////////////////// int VisualScriptSubCall::get_output_sequence_port_count() const { - return 1; } bool VisualScriptSubCall::has_input_sequence_port() const { - return true; } int VisualScriptSubCall::get_input_value_port_count() const { - Ref<Script> script = get_script(); if (script.is_valid() && script->has_method(VisualScriptLanguage::singleton->_subcall)) { - MethodInfo mi = script->get_method_info(VisualScriptLanguage::singleton->_subcall); return mi.arguments.size(); } @@ -3172,20 +2870,16 @@ int VisualScriptSubCall::get_input_value_port_count() const { return 0; } int VisualScriptSubCall::get_output_value_port_count() const { - return 1; } String VisualScriptSubCall::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptSubCall::get_input_value_port_info(int p_idx) const { - Ref<Script> script = get_script(); if (script.is_valid() && script->has_method(VisualScriptLanguage::singleton->_subcall)) { - MethodInfo mi = script->get_method_info(VisualScriptLanguage::singleton->_subcall); return mi.arguments[p_idx]; } @@ -3194,7 +2888,6 @@ PropertyInfo VisualScriptSubCall::get_input_value_port_info(int p_idx) const { } PropertyInfo VisualScriptSubCall::get_output_value_port_info(int p_idx) const { - Ref<Script> script = get_script(); if (script.is_valid() && script->has_method(VisualScriptLanguage::singleton->_subcall)) { MethodInfo mi = script->get_method_info(VisualScriptLanguage::singleton->_subcall); @@ -3204,12 +2897,10 @@ PropertyInfo VisualScriptSubCall::get_output_value_port_info(int p_idx) const { } String VisualScriptSubCall::get_caption() const { - return "SubCall"; } String VisualScriptSubCall::get_text() const { - Ref<Script> script = get_script(); if (script.is_valid()) { if (script->get_name() != String()) @@ -3222,7 +2913,6 @@ String VisualScriptSubCall::get_text() const { } String VisualScriptSubCall::get_category() const { - return "custom"; } @@ -3236,7 +2926,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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 (!valid) { r_error_str = "Node requires a script with a _subcall(<args>) method to work."; r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; @@ -3248,7 +2937,6 @@ public: }; VisualScriptNodeInstance *VisualScriptSubCall::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceSubCall *instance = memnew(VisualScriptNodeInstanceSubCall); instance->instance = p_instance; Ref<Script> script = get_script(); @@ -3262,7 +2950,6 @@ VisualScriptNodeInstance *VisualScriptSubCall::instance(VisualScriptInstance *p_ } 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); @@ -3276,12 +2963,10 @@ VisualScriptSubCall::VisualScriptSubCall() { ////////////////////////////////////////// int VisualScriptComment::get_output_sequence_port_count() const { - return 0; } bool VisualScriptComment::has_input_sequence_port() const { - return false; } @@ -3289,37 +2974,30 @@ int VisualScriptComment::get_input_value_port_count() const { return 0; } int VisualScriptComment::get_output_value_port_count() const { - return 0; } String VisualScriptComment::get_output_sequence_port_text(int p_port) const { - return String(); } PropertyInfo VisualScriptComment::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptComment::get_output_value_port_info(int p_idx) const { - return PropertyInfo(); } String VisualScriptComment::get_caption() const { - return title; } String VisualScriptComment::get_text() const { - return description; } void VisualScriptComment::set_title(const String &p_title) { - if (title == p_title) return; title = p_title; @@ -3327,36 +3005,30 @@ void VisualScriptComment::set_title(const String &p_title) { } String VisualScriptComment::get_title() const { - return title; } void VisualScriptComment::set_description(const String &p_description) { - if (description == p_description) return; description = p_description; ports_changed_notify(); } String VisualScriptComment::get_description() const { - return description; } void VisualScriptComment::set_size(const Size2 &p_size) { - if (size == p_size) return; size = p_size; ports_changed_notify(); } Size2 VisualScriptComment::get_size() const { - return size; } String VisualScriptComment::get_category() const { - return "data"; } @@ -3367,20 +3039,17 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - return 0; } }; VisualScriptNodeInstance *VisualScriptComment::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceComment *instance = memnew(VisualScriptNodeInstanceComment); instance->instance = p_instance; return instance; } void VisualScriptComment::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_title", "title"), &VisualScriptComment::set_title); ClassDB::bind_method(D_METHOD("get_title"), &VisualScriptComment::get_title); @@ -3396,7 +3065,6 @@ void VisualScriptComment::_bind_methods() { } VisualScriptComment::VisualScriptComment() { - title = "Comment"; size = Size2(150, 150); } @@ -3406,12 +3074,10 @@ VisualScriptComment::VisualScriptComment() { ////////////////////////////////////////// int VisualScriptConstructor::get_output_sequence_port_count() const { - return 0; } bool VisualScriptConstructor::has_input_sequence_port() const { - return false; } @@ -3419,37 +3085,30 @@ int VisualScriptConstructor::get_input_value_port_count() const { return constructor.arguments.size(); } int VisualScriptConstructor::get_output_value_port_count() const { - return 1; } String VisualScriptConstructor::get_output_sequence_port_text(int p_port) const { - return ""; } PropertyInfo VisualScriptConstructor::get_input_value_port_info(int p_idx) const { - return constructor.arguments[p_idx]; } PropertyInfo VisualScriptConstructor::get_output_value_port_info(int p_idx) const { - return PropertyInfo(type, "value"); } String VisualScriptConstructor::get_caption() const { - return "Construct " + Variant::get_type_name(type); } String VisualScriptConstructor::get_category() const { - return "functions"; } void VisualScriptConstructor::set_constructor_type(Variant::Type p_type) { - if (type == p_type) return; @@ -3458,18 +3117,15 @@ void VisualScriptConstructor::set_constructor_type(Variant::Type p_type) { } Variant::Type VisualScriptConstructor::get_constructor_type() const { - return type; } void VisualScriptConstructor::set_constructor(const Dictionary &p_info) { - constructor = MethodInfo::from_dict(p_info); ports_changed_notify(); } Dictionary VisualScriptConstructor::get_constructor() const { - return constructor; } @@ -3482,7 +3138,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - Callable::CallError ce; *p_outputs[0] = Variant::construct(type, p_inputs, argcount, ce); if (ce.error != Callable::CallError::CALL_OK) { @@ -3494,7 +3149,6 @@ public: }; VisualScriptNodeInstance *VisualScriptConstructor::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceConstructor *instance = memnew(VisualScriptNodeInstanceConstructor); instance->instance = p_instance; instance->type = type; @@ -3503,7 +3157,6 @@ VisualScriptNodeInstance *VisualScriptConstructor::instance(VisualScriptInstance } void VisualScriptConstructor::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_constructor_type", "type"), &VisualScriptConstructor::set_constructor_type); ClassDB::bind_method(D_METHOD("get_constructor_type"), &VisualScriptConstructor::get_constructor_type); @@ -3515,14 +3168,12 @@ void VisualScriptConstructor::_bind_methods() { } VisualScriptConstructor::VisualScriptConstructor() { - type = Variant::NIL; } static Map<String, Pair<Variant::Type, MethodInfo>> constructor_map; static Ref<VisualScriptNode> create_constructor_node(const String &p_name) { - ERR_FAIL_COND_V(!constructor_map.has(p_name), Ref<VisualScriptNode>()); Ref<VisualScriptConstructor> vsc; @@ -3538,12 +3189,10 @@ static Ref<VisualScriptNode> create_constructor_node(const String &p_name) { ////////////////////////////////////////// int VisualScriptLocalVar::get_output_sequence_port_count() const { - return 0; } bool VisualScriptLocalVar::has_input_sequence_port() const { - return false; } @@ -3551,36 +3200,29 @@ int VisualScriptLocalVar::get_input_value_port_count() const { return 0; } int VisualScriptLocalVar::get_output_value_port_count() const { - return 1; } String VisualScriptLocalVar::get_output_sequence_port_text(int p_port) const { - return ""; } PropertyInfo VisualScriptLocalVar::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptLocalVar::get_output_value_port_info(int p_idx) const { - return PropertyInfo(type, name); } String VisualScriptLocalVar::get_caption() const { - return "Get Local Var"; } String VisualScriptLocalVar::get_category() const { - return "data"; } void VisualScriptLocalVar::set_var_name(const StringName &p_name) { - if (name == p_name) return; @@ -3589,18 +3231,15 @@ void VisualScriptLocalVar::set_var_name(const StringName &p_name) { } StringName VisualScriptLocalVar::get_var_name() const { - return name; } void VisualScriptLocalVar::set_var_type(Variant::Type p_type) { - type = p_type; ports_changed_notify(); } Variant::Type VisualScriptLocalVar::get_var_type() const { - return type; } @@ -3611,14 +3250,12 @@ public: virtual int get_working_memory_size() const { return 1; } 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) { - *p_outputs[0] = *p_working_mem; return 0; } }; VisualScriptNodeInstance *VisualScriptLocalVar::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceLocalVar *instance = memnew(VisualScriptNodeInstanceLocalVar); instance->instance = p_instance; instance->name = name; @@ -3627,7 +3264,6 @@ VisualScriptNodeInstance *VisualScriptLocalVar::instance(VisualScriptInstance *p } void VisualScriptLocalVar::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_var_name", "name"), &VisualScriptLocalVar::set_var_name); ClassDB::bind_method(D_METHOD("get_var_name"), &VisualScriptLocalVar::get_var_name); @@ -3644,7 +3280,6 @@ void VisualScriptLocalVar::_bind_methods() { } VisualScriptLocalVar::VisualScriptLocalVar() { - name = "new_local"; type = Variant::NIL; } @@ -3654,12 +3289,10 @@ VisualScriptLocalVar::VisualScriptLocalVar() { ////////////////////////////////////////// int VisualScriptLocalVarSet::get_output_sequence_port_count() const { - return 1; } bool VisualScriptLocalVarSet::has_input_sequence_port() const { - return true; } @@ -3667,41 +3300,33 @@ int VisualScriptLocalVarSet::get_input_value_port_count() const { return 1; } int VisualScriptLocalVarSet::get_output_value_port_count() const { - return 1; } String VisualScriptLocalVarSet::get_output_sequence_port_text(int p_port) const { - return ""; } PropertyInfo VisualScriptLocalVarSet::get_input_value_port_info(int p_idx) const { - return PropertyInfo(type, "set"); } PropertyInfo VisualScriptLocalVarSet::get_output_value_port_info(int p_idx) const { - return PropertyInfo(type, "get"); } String VisualScriptLocalVarSet::get_caption() const { - return "Set Local Var"; } String VisualScriptLocalVarSet::get_text() const { - return name; } String VisualScriptLocalVarSet::get_category() const { - return "data"; } void VisualScriptLocalVarSet::set_var_name(const StringName &p_name) { - if (name == p_name) return; @@ -3710,18 +3335,15 @@ void VisualScriptLocalVarSet::set_var_name(const StringName &p_name) { } StringName VisualScriptLocalVarSet::get_var_name() const { - return name; } void VisualScriptLocalVarSet::set_var_type(Variant::Type p_type) { - type = p_type; ports_changed_notify(); } Variant::Type VisualScriptLocalVarSet::get_var_type() const { - return type; } @@ -3732,7 +3354,6 @@ public: virtual int get_working_memory_size() const { return 1; } 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) { - *p_working_mem = *p_inputs[0]; *p_outputs[0] = *p_working_mem; return 0; @@ -3740,7 +3361,6 @@ public: }; VisualScriptNodeInstance *VisualScriptLocalVarSet::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceLocalVarSet *instance = memnew(VisualScriptNodeInstanceLocalVarSet); instance->instance = p_instance; instance->name = name; @@ -3749,7 +3369,6 @@ VisualScriptNodeInstance *VisualScriptLocalVarSet::instance(VisualScriptInstance } void VisualScriptLocalVarSet::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_var_name", "name"), &VisualScriptLocalVarSet::set_var_name); ClassDB::bind_method(D_METHOD("get_var_name"), &VisualScriptLocalVarSet::get_var_name); @@ -3766,7 +3385,6 @@ void VisualScriptLocalVarSet::_bind_methods() { } VisualScriptLocalVarSet::VisualScriptLocalVarSet() { - name = "new_local"; type = Variant::NIL; } @@ -3776,12 +3394,10 @@ VisualScriptLocalVarSet::VisualScriptLocalVarSet() { ////////////////////////////////////////// int VisualScriptInputAction::get_output_sequence_port_count() const { - return 0; } bool VisualScriptInputAction::has_input_sequence_port() const { - return false; } @@ -3789,21 +3405,17 @@ int VisualScriptInputAction::get_input_value_port_count() const { return 0; } int VisualScriptInputAction::get_output_value_port_count() const { - return 1; } String VisualScriptInputAction::get_output_sequence_port_text(int p_port) const { - return ""; } PropertyInfo VisualScriptInputAction::get_input_value_port_info(int p_idx) const { - return PropertyInfo(); } PropertyInfo VisualScriptInputAction::get_output_value_port_info(int p_idx) const { - String mstr; switch (mode) { case MODE_PRESSED: { @@ -3824,17 +3436,14 @@ PropertyInfo VisualScriptInputAction::get_output_value_port_info(int p_idx) cons } String VisualScriptInputAction::get_caption() const { - return "Action " + name; } String VisualScriptInputAction::get_category() const { - return "data"; } void VisualScriptInputAction::set_action_name(const StringName &p_name) { - if (name == p_name) return; @@ -3843,12 +3452,10 @@ void VisualScriptInputAction::set_action_name(const StringName &p_name) { } StringName VisualScriptInputAction::get_action_name() const { - return name; } void VisualScriptInputAction::set_action_mode(Mode p_mode) { - if (mode == p_mode) return; @@ -3856,7 +3463,6 @@ void VisualScriptInputAction::set_action_mode(Mode p_mode) { ports_changed_notify(); } VisualScriptInputAction::Mode VisualScriptInputAction::get_action_mode() const { - return mode; } @@ -3867,7 +3473,6 @@ public: VisualScriptInputAction::Mode mode; 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) { - switch (mode) { case VisualScriptInputAction::MODE_PRESSED: { *p_outputs[0] = Input::get_singleton()->is_action_pressed(action); @@ -3888,7 +3493,6 @@ public: }; VisualScriptNodeInstance *VisualScriptInputAction::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceInputAction *instance = memnew(VisualScriptNodeInstanceInputAction); instance->instance = p_instance; instance->action = name; @@ -3898,9 +3502,7 @@ VisualScriptNodeInstance *VisualScriptInputAction::instance(VisualScriptInstance } void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { - if (property.name == "action") { - property.hint = PROPERTY_HINT_ENUM; String actions; @@ -3932,7 +3534,6 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { } void VisualScriptInputAction::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_action_name", "name"), &VisualScriptInputAction::set_action_name); ClassDB::bind_method(D_METHOD("get_action_name"), &VisualScriptInputAction::get_action_name); @@ -3949,7 +3550,6 @@ void VisualScriptInputAction::_bind_methods() { } VisualScriptInputAction::VisualScriptInputAction() { - name = ""; mode = MODE_PRESSED; } @@ -3959,12 +3559,10 @@ VisualScriptInputAction::VisualScriptInputAction() { ////////////////////////////////////////// int VisualScriptDeconstruct::get_output_sequence_port_count() const { - return 0; } bool VisualScriptDeconstruct::has_input_sequence_port() const { - return false; } @@ -3972,37 +3570,30 @@ int VisualScriptDeconstruct::get_input_value_port_count() const { return 1; } int VisualScriptDeconstruct::get_output_value_port_count() const { - return elements.size(); } String VisualScriptDeconstruct::get_output_sequence_port_text(int p_port) const { - return ""; } PropertyInfo VisualScriptDeconstruct::get_input_value_port_info(int p_idx) const { - return PropertyInfo(type, "value"); } PropertyInfo VisualScriptDeconstruct::get_output_value_port_info(int p_idx) const { - return PropertyInfo(elements[p_idx].type, elements[p_idx].name); } String VisualScriptDeconstruct::get_caption() const { - return "Deconstruct " + Variant::get_type_name(type); } String VisualScriptDeconstruct::get_category() const { - return "functions"; } void VisualScriptDeconstruct::_update_elements() { - elements.clear(); Variant v; Callable::CallError ce; @@ -4012,7 +3603,6 @@ void VisualScriptDeconstruct::_update_elements() { v.get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - Element e; e.name = E->get().name; e.type = E->get().type; @@ -4021,7 +3611,6 @@ void VisualScriptDeconstruct::_update_elements() { } void VisualScriptDeconstruct::set_deconstruct_type(Variant::Type p_type) { - if (type == p_type) return; @@ -4032,12 +3621,10 @@ void VisualScriptDeconstruct::set_deconstruct_type(Variant::Type p_type) { } Variant::Type VisualScriptDeconstruct::get_deconstruct_type() const { - return type; } void VisualScriptDeconstruct::_set_elem_cache(const Array &p_elements) { - ERR_FAIL_COND(p_elements.size() % 2 == 1); elements.resize(p_elements.size() / 2); for (int i = 0; i < elements.size(); i++) { @@ -4047,7 +3634,6 @@ void VisualScriptDeconstruct::_set_elem_cache(const Array &p_elements) { } Array VisualScriptDeconstruct::_get_elem_cache() const { - Array ret; for (int i = 0; i < elements.size(); i++) { ret.push_back(elements[i].name); @@ -4064,7 +3650,6 @@ public: //virtual int get_working_memory_size() const { return 0; } 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) { - Variant in = *p_inputs[0]; for (int i = 0; i < outputs.size(); i++) { @@ -4082,7 +3667,6 @@ public: }; VisualScriptNodeInstance *VisualScriptDeconstruct::instance(VisualScriptInstance *p_instance) { - VisualScriptNodeInstanceDeconstruct *instance = memnew(VisualScriptNodeInstanceDeconstruct); instance->instance = p_instance; instance->outputs.resize(elements.size()); @@ -4097,7 +3681,6 @@ void VisualScriptDeconstruct::_validate_property(PropertyInfo &property) const { } void VisualScriptDeconstruct::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_deconstruct_type", "type"), &VisualScriptDeconstruct::set_deconstruct_type); ClassDB::bind_method(D_METHOD("get_deconstruct_type"), &VisualScriptDeconstruct::get_deconstruct_type); @@ -4114,7 +3697,6 @@ void VisualScriptDeconstruct::_bind_methods() { } VisualScriptDeconstruct::VisualScriptDeconstruct() { - type = Variant::NIL; } @@ -4127,7 +3709,6 @@ static Ref<VisualScriptNode> create_node_deconst_typed(const String &p_name) { } void register_visual_script_nodes() { - VisualScriptLanguage::singleton->add_register_func("data/set_variable", create_node_generic<VisualScriptVariableSet>); VisualScriptLanguage::singleton->add_register_func("data/get_variable", create_node_generic<VisualScriptVariableGet>); VisualScriptLanguage::singleton->add_register_func("data/engine_singleton", create_node_generic<VisualScriptEngineSingleton>); @@ -4199,12 +3780,10 @@ void register_visual_script_nodes() { VisualScriptLanguage::singleton->add_register_func("functions/compose_array", create_node_generic<VisualScriptComposeArray>); for (int i = 1; i < Variant::VARIANT_MAX; i++) { - List<MethodInfo> constructors; Variant::get_constructor_list(Variant::Type(i), &constructors); for (List<MethodInfo>::Element *E = constructors.front(); E; E = E->next()) { - if (E->get().arguments.size() > 0) { String name = "functions/constructors/" + Variant::get_type_name(Variant::Type(i)) + "("; for (int j = 0; j < E->get().arguments.size(); j++) { @@ -4229,6 +3808,5 @@ void register_visual_script_nodes() { } void unregister_visual_script_nodes() { - constructor_map.clear(); } |