diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2021-07-13 10:39:43 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2021-07-18 19:41:51 +0300 |
commit | 88088f351ab093f489d4320cf8f3376de9481e59 (patch) | |
tree | 21f2a4e967d319bec79f2bfc63edd1ed8566f373 /modules/visual_script | |
parent | b76dfde329592ecfd6f6b952082ae21859039e67 (diff) |
Prevents some warnings from appearing in visual scripts
Diffstat (limited to 'modules/visual_script')
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 16 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 8712bfa06b..57a631fb6a 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -2836,6 +2836,20 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot, ERR_FAIL_COND(from_seq != to_seq); + // Checking to prevent warnings. + if (from_seq) { + if (script->has_sequence_connection(p_from.to_int(), from_port, p_to.to_int())) { + return; + } + } else if (script->has_data_connection(p_from.to_int(), from_port, p_to.to_int(), to_port)) { + return; + } + + // Preventing connection to itself. + if (p_from.to_int() == p_to.to_int()) { + return; + } + // Do all the checks here. StringName func; // This the func where we store the one the nodes at the end of the resolution on having multiple nodes. @@ -2989,7 +3003,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_port_ac Ref<VisualScriptNode> node = script->get_node(p_port_action_node); - if (!node.is_valid()) { + if (!node.is_valid() || node->get_output_value_port_count() <= p_port_action_output) { return tg; } diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index b93c710652..41b51c6e65 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -191,7 +191,10 @@ PropertyInfo VisualScriptFunction::get_input_value_port_info(int p_idx) const { } PropertyInfo VisualScriptFunction::get_output_value_port_info(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, arguments.size(), PropertyInfo()); + // Need to check it without ERR_FAIL_COND, to prevent warnings from appearing on node creation via dragging. + if (p_idx < 0 || p_idx >= arguments.size()) { + return PropertyInfo(); + } PropertyInfo out; out.type = arguments[p_idx].type; out.name = arguments[p_idx].name; |