summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2020-10-02 09:06:13 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2020-10-02 09:06:13 +0300
commitdc713e149f5be41d2778a308a3da61b459a08289 (patch)
tree56c88e6b0a085a6f7fd4da9f3c82bd72cda42379 /scene/resources
parent5e726d8d2025f1bc52299894230d94ef5972cea4 (diff)
Fix VisualShaderNode::set_output_port_connected
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/visual_shader.cpp10
-rw-r--r--scene/resources/visual_shader.h3
2 files changed, 4 insertions, 9 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index b8d2003e68..84437faca0 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -65,20 +65,16 @@ bool VisualShaderNode::is_port_separator(int p_index) const {
bool VisualShaderNode::is_output_port_connected(int p_port) const {
if (connected_output_ports.has(p_port)) {
- return connected_output_ports[p_port];
+ return connected_output_ports[p_port] > 0;
}
return false;
}
void VisualShaderNode::set_output_port_connected(int p_port, bool p_connected) {
if (p_connected) {
- connected_output_ports[p_port] = true;
- ++connected_output_count;
+ connected_output_ports[p_port]++;
} else {
- --connected_output_count;
- if (connected_output_count == 0) {
- connected_output_ports[p_port] = false;
- }
+ connected_output_ports[p_port]--;
}
}
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index e7d74b6c17..e3d5200e6b 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -193,8 +193,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;
+ Map<int, int> connected_output_ports;
protected:
bool simple_decl = true;