Fix small reconnection bug in visual shader

This commit is contained in:
Yuri Roubinsky 2020-07-31 10:40:05 +03:00
parent bb6adf4ef9
commit 4d52456613
2 changed files with 10 additions and 1 deletions

View file

@ -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 {

View file

@ -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;