diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2020-07-31 10:40:05 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2020-07-31 10:40:05 +0300 |
commit | 4d5245661399cd1d72bc590acd2004f8a5cbeae8 (patch) | |
tree | 99bf9374e7cb69eb29ef748701ac19a92952d373 /scene/resources | |
parent | bb6adf4ef92ca7fed5701e55e595ad35489cbc2c (diff) |
Fix small reconnection bug in visual shader
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/visual_shader.cpp | 10 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 8b84ce9e8c..e4851ad9f7 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -71,7 +71,15 @@ bool VisualShaderNode::is_output_port_connected(int p_port) const { } void VisualShaderNode::set_output_port_connected(int p_port, bool p_connected) { - connected_output_ports[p_port] = p_connected; + if (p_connected) { + connected_output_ports[p_port] = true; + ++connected_output_count; + } else { + --connected_output_count; + if (connected_output_count == 0) { + connected_output_ports[p_port] = false; + } + } } bool VisualShaderNode::is_input_port_connected(int p_port) const { diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index d74269cfc6..05d8950be9 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -184,6 +184,7 @@ class VisualShaderNode : public Resource { Map<int, Variant> default_input_values; Map<int, bool> connected_input_ports; Map<int, bool> connected_output_ports; + int connected_output_count = 0; protected: bool simple_decl; |