1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Merge pull request #28375 from Chaosus/fix_vs_loopback

Disallow loopback connection in visual shaders
This commit is contained in:
Yuri Roubinsky
2019-04-24 09:41:06 +03:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -757,7 +757,6 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in
int to = p_to.to_int(); int to = p_to.to_int();
if (!visual_shader->can_connect_nodes(type, from, p_from_index, to, p_to_index)) { if (!visual_shader->can_connect_nodes(type, from, p_from_index, to, p_to_index)) {
EditorNode::get_singleton()->show_warning(TTR("Unable to connect, port may be in use or connection may be invalid."));
return; return;
} }

View File

@@ -240,6 +240,9 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po
if (!g->nodes.has(p_from_node)) if (!g->nodes.has(p_from_node))
return false; return false;
if (p_from_node == p_to_node)
return false;
if (p_from_port < 0 || p_from_port >= g->nodes[p_from_node].node->get_output_port_count()) if (p_from_port < 0 || p_from_port >= g->nodes[p_from_node].node->get_output_port_count())
return false; return false;