summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/visual_shader.cpp10
-rw-r--r--scene/resources/visual_shader.h1
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;